bugGNU Octave - Bugs: bug #38464, image: regionprops misses some...


bug #38464: image: regionprops misses some pixels?

Submitted by:  Juan Pablo Carbajal <juanpi>
Submitted on:  Mon 04 Mar 2013 06:54:08 PM UTC  
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Duplicate Assigned to:  None
Originator Name:  juanpi Open/Closed:  Closed
Release:  3.6.4 Operating System:  GNU/Linux

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)

Sun 03 Nov 2013 05:40:45 AM UTC, comment #7:

So I took a closer look to this, compared with Matlab and Octave's image package old and development release and swapping the order on the call to plot. The bug is fixed now (it's a duplicate of bug #39701).

The code in the original submission is wrong. Even in Matlab is wrong, the coordinates are swapped. If they are fixed as suggested on comment #4, then it works in Matlab. I'm guessing the reason why they were swapped to start with is because of bug #39701 (now fixed) that caused regionprops to soemtimes return the Centroid coordinates swap (and in the attached image it was doing it for most of the objects) so swapping was actually trying to fix it (but then the correct ones were wrong).

Current version of the Octave package (cset 939332b5142e) works fine and I don't see any object being missed. If I undo cset ab0ac77d350b (which fixed bug #39701) then I get a big mess. Swapping back the coordinates to the wrong order, it plots the circle on most of the centroid coordinates and looks like it's missing some objects but in reality it's just drawing them in other places. The ones being drawn correctly (the majority) are actually the ones with the wrong coordinates that regionprops was swapping.

Closing as duplicate.

Carnë Draug <carandraug>
Project Member
Sun 03 Nov 2013 03:27:07 AM UTC, comment #6:


Can you try the code on the original submission and see what is the problem there? Maybe is an issue that wasn't correctly identified.

Juan Pablo Carbajal <juanpi>
Project Member
Sat 02 Nov 2013 08:36:26 PM UTC, comment #5:


So Matlab also misses some of the points?

No. Matlab's bwlabel doesn't miss any of the points, and neither does Octave. The bwlabel function will label any non-zero pixel in the image with a positive number. We can confirm that it does not miss any of the points with the following:

While the bwlabel function has changed since this report, the above still returns true when using the lblNodes variable present on the bwlabel_miss.mat file.

It is possible that bwlabel may be labeling two separate objects as being the same, but it's certainly not missing any pixel.

Carnë Draug <carandraug>
Project Member
Sat 02 Nov 2013 05:02:55 PM UTC, comment #4:

The script in the "original submission" shows an image and plots which are bsed on data in bwlabel_miss.mat.

"lblNodes" in bwlabel_miss.mat shows no error and
"data" is missing. If I create nodes with a current regionprops from hg sources it includes all regions.

Please mention that there is an error in your script:
When generating

and plotting nodes with

x and y is swapped. I I use your original script and change x/y:

all regions are shown.

Andreas Weber <andy1978>
Project Member
Sat 02 Nov 2013 03:06:41 PM UTC, comment #3:

So Matlab also misses some of the points?

Running the script i the original submission still generates a quite disappointing result.

Juan Pablo Carbajal <juanpi>
Project Member
Fri 01 Nov 2013 04:58:34 PM UTC, comment #2:

I just compared against the results that Matlab gives when using bwlabel, and the bug is (was?) definitely not in our bwlabel.

Carnë Draug <carandraug>
Project Member
Fri 01 Nov 2013 01:41:55 PM UTC, comment #1:

I tired your test with an image development build from 3.10.2013

and I see all regions. Perhaps this http://sourceforge.net/p/octave/image/ci/ab0ac77d350bb005869498833fbb4427dc4fc933/tree/inst/regionprops.m?diff=b2e168a18d4b443870198eabf6dcfc3de239ba54 changeset fixed it. Can you check your test with the hg sources of image?

Regards, Andy

Andreas Weber <andy1978>
Project Member
Mon 04 Mar 2013 06:54:08 PM UTC, original submission:

Execute the following script (fiel with data attached)

You see that some nodes are not plotted. The matrix lblNodes (also in the file) and the matrix nodes were generated with the following script

Apparently bwlabel nodes misses some of the pixels.
I checked that regionpropos is giving the correct result with other images.

Juan Pablo Carbajal <juanpi>
Project Member


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

Attach Files:

Attached Files
file #27565:  bwlabel_miss.mat added by juanpi (158KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by juanpi (Submitted the item)

    Do you think this task is very important?
    If so, you can 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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    Sun 03 Nov 2013 05:40:45 AM UTC carandraug StatusNone => Duplicate
        Open/ClosedOpen => Closed
    Fri 01 Nov 2013 04:58:34 PM UTC carandraug SummaryIMAGE: bwlabel misses some pixels? => image: regionprops misses some pixels?
    Mon 04 Mar 2013 06:54:08 PM UTC juanpi Attached File- => Added bwlabel_miss.mat, #27565

    Back to the top

    Powered by Savane 3.3