title: Matlab - Indexes of image pixels in bwconncomp function
body: <p>I've been writing a text detection code and I'm working with a binary map as a mask to work on the image. After I get the candidate text regions I apply the <code>bwconncomp</code> function on the image after applying the mask on it to get the position of those regions. </p>
  
  <p>Now I've created a loop to discard the regions that don't satisfy some "clauses". When it doesn't, I put all the pixels in that region to 0 (<code>image(cc.PixelIdxList{region})=0</code>) and the same thing with the binary map (<code>map(cc.PixelIdxList{region})=0</code>). </p>
  
  <p>When I plot the map and the image before getting in the loop they tally, but after it they don't. When I plot the image after the loop it shows that it erased the region perfectly, but that's not the case with the map. Sometimes there are left some pixels that are within the region.</p>
  
  <p>So my guess is: the pixel indexes that <code>bwconncomp</code> gives to the pixels in the image are not exactly the same as those in the map, that's why some pixels in the map aren't erased when they should be. Am I right? Or should I be looking somewhere else?</p>