Hi,
nice work with the cvBlob library.
However, while i was working on a project i discovered a bug in your code.
The function cvRebderBlob misses the last row and column of the blob's ROI.
The lines 181 and 182 in the cvblob.cpp contain a for loop whose for loop
condition should be changed to include also the indexes blob->maxx and
blob->maxy, so:
for (unsigned int r=blob->miny; r<=blob->maxy; r++, labels+=stepLbl,
source+=stepSrc, imgData+=stepDst)
for (unsigned int c=blob->minx; c<=blob->maxx; c++)
i've included a minimal example code to test the difference.
The example creates 10 by 10 pixel image and includes a square of 4 pixels .
After that the cvLabel finds the blobs and they are rendered to an empty 10 by
10 image. In addition all the pixel values are printed to std.
As you can see, 3 out of 4 pixels are missing in the rendered image.
With the '=' added to the for loops, the maxy and maxx are also included and
the rendered image matches the input image.
Jaka
Original issue reported on code.google.com by jkrava...@gmail.com on 14 Feb 2013 at 9:35
Original issue reported on code.google.com by
jkrava...@gmail.com
on 14 Feb 2013 at 9:35Attachments: