bugGNU Octave - Bugs: bug #42115, image package: imadjust does not...

 
 

bug #42115: image package: imadjust does not support integers

Submitted by:  None
Submitted on:  Mon 14 Apr 2014 11:34:18 AM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: NoneAssigned to: None
Originator Name: AnonymousOriginator Email: -unavailable-
Open/Closed: ClosedRelease: other
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 20 Nov 2015 08:16:19 PM UTC, comment #11:

(I haven't managed to "make" the whole image package. But the error message from the make command showed me what parameters for mkoctfile were necessary... So here I am...)

I have used the new version of imadjust.m (also using intlut.cc, is_image.m and stretchlim.m) a bit with uint8 images. And I have NOT come across any obvious errors. So, thank you for expanding the integer support in the image package by a significant bit!

Hartmut <hardy>
Fri 20 Nov 2015 11:11:23 AM UTC, comment #10:

> I tried to do it the lazy way, and wanted to simply compile the new file intlut.cc from inside a normal Octave 4.0 (release) installation (in Ubuntu 14.04, compiling oct files normally works).


That will work if you set the right flags. The image package will handle the flags for you. Just run make install (or make run if you want to just try the package without installing).

Carnë Draug <carandraug>
Project Member
Thu 19 Nov 2015 07:41:03 PM UTC, comment #9:

(I am NOT sure if this is a bug at all...)

I tried to do it the lazy way, and wanted to simply compile the new file intlut.cc from inside a normal Octave 4.0 (release) installation (in Ubuntu 14.04, compiling oct files normally works).

But when I call "mkoctfile intlut.cc", then I get the following lengthy error message:

Is this a problem? Or would I need to compile the whole image repository in order to test this single new file intlut.cc?

Hartmut <hardy>
Wed 18 Nov 2015 09:04:01 PM UTC, comment #8:

As I mentioned before, I pushed some more changes to cover special cases, only for sake of performance

http://hg.code.sf.net/p/octave/image/rev/8dd432a8ad92

I'll consider it all done now but would welcome any feedback and testing.

Carnë Draug <carandraug>
Project Member
Wed 18 Nov 2015 02:51:01 PM UTC, comment #7:

I have pushed http://hg.code.sf.net/p/octave/image/rev/b9120f602e44 which adds support for images of class integer. It uses the approach suggested by Hartmut. It still needs some performance improvements but I already have some ideas how to do it. Testing would be welcome.

This will be part of the next minor release, 2.6.0 or later.

Carnë Draug <carandraug>
Project Member
Tue 17 Nov 2015 01:50:06 PM UTC, comment #6:

I like the LUT alternative.

Unfortunately, as you noticed, intlut also converted to double. I rewrote it in C++ and now performs 5-10x faster and without the bump in memory usage (I'm testing with 500MB uint8 images). I have also been making a bunch of other changes to imadjust, fixing this step by step.

Carnë Draug <carandraug>
Project Member
Sun 01 Nov 2015 08:26:45 PM UTC, comment #5:

How about this alternative approach to deal with integer inputs to imadjust?

  • First, create a lookup table (LUT) where you specify the intended (integer) output value for every possible (integer) input value (there might be for example 256 possibilities, or 65536 ones, depending on the input type). For this creation of a LUT, one could use a conversion to double and then back to integers, because this wouldn't significantly increase the memory consumption. (There are much less possible integer values than pixels in a typical image.)
  • Second, use the existing function intlut.m to convert the integer input image into the integer output image. Since intlut (assumingly) works without an intermediate conversion to double, we wouldn't need significantly more memory for this step either.

Sorry, I've just realised that intlut.m DOES convert the input image to double in an intermediate step. So this approach would also consume much much more memory :(

We could fix this by

  • fixing intlut to NOT convert to double as an intermediate step. (But I am not sure why intlut does this conversion anyways, so I've probably missed something there.)
  • doing something similar to intlut, but as own code inside of the function imadjust itself. Just WITHOUT the step of intermediate conversion to double type.
Hartmut <hardy>
Mon 19 Oct 2015 09:10:16 PM UTC, comment #4:

If you have a better solution, please push it. Otherwise,
the attached cs solves the problem, and should also solve
https://savannah.gnu.org/bugs/?40109.

Avinoam Kalma <avinoam>
Project Member
Mon 24 Aug 2015 05:48:41 PM UTC, comment #3:

I would rather have a nicer fix for this, within imadjust. One that ideally won't cause the image to suddenly take 8x more memory. While the attached changeset is a good temporary workaround, I'd rather have the user do it themselves than apply a quick fix that will most likely become permanent.

Carnë Draug <carandraug>
Project Member
Sun 16 Aug 2015 10:09:20 PM UTC, comment #2:

Please review the attached cs.
It transform the image to double and then back to the original class.

(file #34661)

Avinoam Kalma <avinoam>
Project Member
Mon 14 Apr 2014 02:31:42 PM UTC, comment #1:

This is a known bug. Unfortunately, we haven't come around fixing it. The very first problem is that imadjust expects image of class double, i.e., values in the range [0 1]. If you can provide a patch that would be perfect.

In the mean time, assuming your original image was uint8, you can work around this using:

Carnë Draug <carandraug>
Project Member
Mon 14 Apr 2014 11:34:18 AM UTC, original submission:

# image *| 2.2.1

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #34661:  bug42115.cs added by avinoam (1KiB - text/plain)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by avinoam (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 18 Nov 2015 02:51:01 PM UTCcarandraugOriginator Namenotagain=>Anonymous
      Open/ClosedOpen=>Closed
      Release3.8.1=>other
      Summaryimage package: imadjust output differs from Matlab=>image package: imadjust does not support integers
    Tue 10 Nov 2015 03:13:05 PM UTCcarandraugDependencies-=>bugs #40109 is dependent
    Sun 16 Aug 2015 10:09:20 PM UTCavinoamAttached File-=>Added bug42115.cs, #34661
    Sun 28 Sep 2014 06:16:37 PM UTCcarandraugDependencies-=>bugs #43315 is dependent
    Mon 14 Apr 2014 02:31:42 PM UTCcarandraugSummaryimadjust output differs from Matlab=>image package: imadjust output differs from Matlab

    Back to the top


    Powered by Savane 3.1-cleanup1