Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Image Connective Component
    primarykey
    data
    text
    <p>I have this program to detect objects in a binarized BufferedImage, which the image is a multiple choice answer sheet.<br> I'm trying to use 4-Connectivity as in to detect each object (answer on the sheet).<br> So far what I have in hand as source is these:</p> <ol> <li><a href="http://en.wikipedia.org/wiki/Connected-component_labeling" rel="nofollow">http://en.wikipedia.org/wiki/Connected-component_labeling</a></li> <li><a href="http://homepages.inf.ed.ac.uk/rbf/HIPR2/label.htm" rel="nofollow">http://homepages.inf.ed.ac.uk/rbf/HIPR2/label.htm</a></li> </ol> <p>and I have came up with this, following instructions from Wikipedia:</p> <pre><code>if(getPixel(image, x, y) != 0){ if(getPixel(image, x-1, y) !=0){ System.out.println("we are in the same region"); region[x][y] = region[x-1][y]; } else if(getPixel(image, x-1, y) !=0 &amp;&amp; getPixel(image, x, y-1) !=0){ System.out.println("North and West pixels belong to the same region and must be merged"); region[x][y] = Math.min(region[x-1][y], region[x][y-1]); } else if( getPixel(image, x-1, y) ==0 &amp;&amp; getPixel(image, x, y-1) !=0){ System.out.println("Assign the label of the North pixel to the current pixel"); region[x][y] = region[x][y-1]; } else if(getPixel(image, x-1, y) ==0 &amp;&amp; getPixel(image, x, y-1) ==0){ System.out.println("Create a new label id and assign it to the current pixel"); cpt++; region[x][y] = cpt; } </code></pre> <p>But the problem is it creates 51 regions! and it only prints a couple of top pixels of each object (not all pixels).<br> Can anyone please help me to find what the problem is and how can I detect my objects?<br> I would appreciate any help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload