patchGNU Octave - Patches: patch #8722, [octave forge] (image) implement...

 
 

patch #8722: [octave forge] (image) implement impixelinfo and impixelinfoval

Submitter:  None
Submitted:  Fri 21 Aug 2015 05:14:32 PM UTC
   
 
Category:  Forge : new function Priority:  5 - Normal
Status:  In Progress Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 04 Sep 2021 08:27:39 AM UTC, comment #19: 

Hi at all,
I don't have time to work on this and I'm happy that hardy made such a detailed review. So @hardy: please go ahead and fix it. And now, I don't know if the extent property was fixed in the meanwhile.

Thank you both for keeping care of this.

-- Andy

Andreas Weber <andy1978>
Group Member
Fri 03 Sep 2021 11:59:41 AM UTC, comment #18: 

@Hartmut, thanks for your detailed review.

I will be glad if you change the code yourself if no one else does it.

@Andy, as the original author, what is your opinion?

Avinoam Kalma <avinoam>
Group Member
Sat 22 May 2021 04:21:29 PM UTC, comment #17: 

I have tested the files from Andreas (see his comment #15) and they work quite reasonably, already.

Regarding the question in comment #16: Andreas' current implementation shows the coordinates (1,1) for the top-left most black pixel in this example image. This is identical to what Matlab shows. Also the displayed coordinate value for the bottom-right most black pixel is identical to what Matlab displays. I think there is no need to improve the 0/1 coordinate origin in any way.

Nevertheless I have found some minor issues with this code:

  • When the mouse position is outside of the image position this code now displays "no image". Matlab displays a different dummy text in this situation: "Pixel Info (X,Y) Intensity".
  • The displayed text string currently has a surplus closed bracket at the end (at least in the case of grayvalue images).
  • The function impixelinfo does not return any handle (it should return a handle to a uipanel object). This could easily be fixed by returning the already existing h variable.
  • The function impixelinfoval does also not return any handle (it should return a handle to a uicontrol object). This could easily be fixed by returning the already existing txt variable.
  • The function impixelinfoval checks if it is called from inside impixelinfo and then generates a different text string (including the additional "Pixel Info" string). This seems overly complex to me. Could we not skip this check in impixelinfoval, and then add this "Pixel Info" string at the beginning of the displayed string inside of the calling impixelinfo.m? Or is there a good reason to do it this way?
  • There are also a couple of "fix me" issues mentioned in the code itself:
    • The documentation text at the beginning of the file is missing in both files.
    • Indexed images do not yet work.
  • I see the error message "error: get: H must be a graphics handle" when running the test_it.m script and using the mouse in figure 3 (with the 2 subplots).


I think most of the issues could easily be fixed. And I would like to see these two new functions included into the image package.

@Andreas: Do you know if the Octave issue with the "extent" property, that you mention in your code, has already been fixed in the meantime?

How should we proceed here?

  • Is anyone currently still working on this?
  • If not: Is anyone willing to work on this with the prospect of having this included in the image package eventually?
  • If also not: Would anyone mind if I changed the code myself? (Only in case I find the necessary time before someone else does.)
Hartmut <hardy>
Wed 28 Apr 2021 03:41:13 PM UTC, comment #16: 

Is there a standard open source image to test against this?

Using the ruler.512 image from
http://sipi.usc.edu/database/database.php?volume=misc&image=39#top

From http://sipi.usc.edu/database/copyright.php

gray21.512, ruler.512        Test patterns constructed at USC-SIPI. Free to use.


With command


imshow (imread("ruler.512.tiff"));impixelinfo;


This appears to be working but the origin is (1,1) should it be (0,0)?

Anonymous
Fri 03 Nov 2017 09:50:40 AM UTC, comment #15: 

@Avinoam: I forgot these patches... Or as far as I remember I lost track because I tired to hunt a bug with different text extent (which was a part of these patches)

I've created a repo on github: https://github.com/octave-de/octave-impixelinfo

If someone help to polish it send a short message with github user and I#ll give write access.

Andreas Weber <andy1978>
Group Member
Wed 22 Feb 2017 09:30:06 PM UTC, comment #14: 

What's the status of impixelinfo and impixelinfoval patches?

Avinoam Kalma <avinoam>
Group Member
Thu 08 Sep 2016 09:33:04 PM UTC, comment #13: 

I didn't know that the axes could return the currentpoint in axes data coordinates (I used figures currentpoint), which would have saved me a lot of trouble as I had to change figure coordinates into axes coordinates  (which depends on many things ...).
Andy's implementation is much cleaner and simpler. Forget about mine.

Pantxo Diribarne <pantxo>
Group Member
Thu 08 Sep 2016 09:12:00 PM UTC, comment #12: 

Oh how dissapointed I am ... I have worked out independently an implementation of impixelinfo and impixelinfoval. They are still in a draft state but I attached them here (before reading what has been done) and in case anything can be helpful.


(file #38455, file #38456)

Pantxo Diribarne <pantxo>
Group Member
Wed 13 Jul 2016 03:09:57 PM UTC, comment #11: 

@Andreas
It looks like you've got it pretty much in hand, so please go ahead. I was going to take a different approach, and am not nearly as far along as you are.

Thanks!

Eric Addison <easports>
Wed 13 Jul 2016 08:30:03 AM UTC, comment #10: 

@Eric: Do you want to work on impixelinfo and impixelinfoval or should I polish the patch?

Andreas Weber <andy1978>
Group Member
Thu 07 Jul 2016 03:23:27 PM UTC, comment #9: 

I've splited the function as discussed with carandraug, see attached tgz. the doit.m is just a helper to check for BW, RGB, grayscale images and so on.

(file #37757)

Andreas Weber <andy1978>
Group Member
Thu 07 Jul 2016 01:31:26 PM UTC, comment #8: 

As discussed on IRC with andy:

> I just looked at your impixelinfo. I think that should be done as impixelinfoval. Matlab seems to include the impixelinfoval control inside the other so it probably impixelinfo calls impixelinfoval.


> carandraug: Do you understand this? "...When created with impixelinfo, the tool is a uipanel object.... When created with impixelinfoval, the tool is a uicontrol object...
> I'm not familiar with ui* object and thought a uicontrol style=text is the same as a panel


> a control is element that you can interact with such as button, piece of text, dropdown menu, etc. A panel is just a place where you can put stuff (other panels or a control)
> so what that sentence means is that impixelinfoval will create a uicontrol with the text only. If you use impixelinfo, then it creates a panel with the text "Pixel Info" which is followed by a uicontrol (the one that created by impixelinfoval) that shows the actual pixelinfp
> this separation of things allows you to place the pixelinfo somewhere else, in your own uipanel


Carnë Draug <carandraug>
Group Member
Thu 07 Jul 2016 12:44:46 PM UTC, comment #7: 

I started implementing impixelinfo last year. I'll attach the last version

(file #37751)

Andreas Weber <andy1978>
Group Member
Thu 07 Jul 2016 11:50:17 AM UTC, comment #6: 

This behaviour needs to be implemented in the image package as impixelinfoval and impixelinfo.

I believe that the development versions of octave make this possible. You will need to create a uicontrol object of type text. Then you need to set a listener on the image that changes the text as the mouse moves over the image.

After looking at the two functions, might be easier to implement impixelinfoval first. The function impixelinfo can then make use of impixelinfoval.

Carnë Draug <carandraug>
Group Member
Thu 07 Jul 2016 01:16:30 AM UTC, comment #5: 

Yes, you're welcome to ask any questions.  I won't necessarily know the answers, but someone else may.

Lachlan Andrew <lachlan>
Wed 06 Jul 2016 10:29:36 PM UTC, comment #4: 

Hi Lachlan!

Thanks for noticing! I would love to get these functions implemented. I will work on these through the weekend.

I know you are probably busy, but could I ask you a few questions as I work through this, most likely related to the best plan for integrating with octave-core?

Thanks again!

Eric Addison <easports>
Wed 06 Jul 2016 01:55:15 PM UTC, comment #3: 

Thanks for this patch, Eric.  I have been wanting something like this!

Do you have any time to refresh the patch and implement impixelinfo and impixelinfoval?  It would be great to get this into Release 4.2.0, but that goes into feature freeze in a week or so.

Lachlan Andrew <lachlan>
Mon 24 Aug 2015 02:13:22 PM UTC, comment #2: 

Understood. I was unaware of those functions in MATLAB. I will move the functionality to impixelinfo and inpixelinfoval.

Thanks for the info!

Eric Addison <easports>
Mon 24 Aug 2015 12:03:26 PM UTC, comment #1: 

This should be done optionally and not by default. Specifically, this should be the job of the missing functions impixelinfo and impixelinfoval (which would be part of the image package).

Carnë Draug <carandraug>
Group Member
Fri 21 Aug 2015 05:14:32 PM UTC, original submission:  

This patch attempts to address the following entry on the Octave wiki projects page (http://wiki.octave.org/Projects)

-- On 'imagesc' plots, report the matrix values also based on the mouse position, updating on mouse moving.

This has been accomplished by altering the Figure::updateStatusBar() method to take an additional QString parameter, i.e.

Figure::updateStatusBar (ColumnVector pt, QString val)

The method was updated to display this QString in the message bar, i.e.

    m_statusBar->showMessage (QString ("(%1, %2)%3")
                              .arg (pt(0), 0, 'g', 5)
                              .arg (pt(1), 0, 'g', 5)
                              .arg(val));
The QString was built inside of the Canvas::canvasMouseMoveEvent() method. The added code computes the integer index location of the mouse in the x and y directions from a combination of the current mouse pixel position and the xdata and ydata properties of the graphics object, then uses these indices to retrieve the double value from cdata. Here is the added code:

          ColumnVector v = ap.pixel2coord (event->x (), event->y ());
          QString val = QString ("");
          if (currentObj.isa ("image"))
           {
              octave_value xdata = currentObj.get ("xdata");
              octave_value ydata = currentObj.get ("ydata");
              octave_value cdata = currentObj.get ("cdata");
              int x = floor (xdata.size ()(0) * v(0)
                             / xdata.matrix_value()(xdata.size ()(0)-1) - 0.5);
              int y = floor (ydata.size ()(0) * v(1)
                             / ydata.matrix_value ()(ydata.size ()(0)-1) - 0.5);
              val = QString (" : %1").arg (cdata.matrix_value ()(y,x),0,'g',5);
            }
          fig->updateStatusBar (v,val);

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38455:  impixelinfoval.m added by pantxo (6KiB - text/x-objcsrc)
file #38456:  impixelinfo.m added by pantxo (3KiB - text/x-objcsrc)
file #37757:  impixelinfo.tar.gz added by andy1978 (2KiB - application/gzip)
file #37751:  impixelinfo.m added by andy1978 (3KiB - d2l/unknowntype)
file #34690:  displayImageValues.diff added by None (3KiB - text/x-patch - Diff file to update Figure.h, Figure.cc, and Canvas.h)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by andy1978 (Updated the item)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by easports (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-10-21 mtmiller Carbon-CopyRemoved 80942 -
    2018-04-10 mtmiller CategoryNone Forge : new function
        Summaryimplement impixelinfo and impixelinfoval [octave forge] (image) implement impixelinfo and impixelinfoval
    2018-03-26 pantxo Dependencies- bugs #53476 is dependent
    2017-02-22 avinoam Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
    2016-09-08 pantxo Attached File- Added impixelinfoval.m, #38455
        Attached File- Added impixelinfo.m, #38456
    2016-07-07 andy1978 Attached File- Added impixelinfo.tar.gz, #37757
    2016-07-07 andy1978 Attached File- Added impixelinfo.m, #37751
    2016-07-07 carandraug SummaryFor image() and imagesc(), added value readout in status bar when mousing over a figure implement impixelinfo and impixelinfoval
    2016-07-07 lachlan StatusNone In Progress
    2015-08-21 None Attached File- Added displayImageValues.diff, #34690

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code