4

Please can some one explain how to identify area which are should in red and blue colors in following image ? I tried to use cvFindContours() method but it didn't give expected result for me.

Input image

enter image description here

Expected result

enter image description here I Like to know whether there are any other methods to identify or calculate the area of this kind of contours. Please be kind enough to share simple code example with this.

2
  • It seems that you could simply find all contours and keep the 2 biggest ones, could not you ? Sep 2, 2012 at 19:18
  • 1
    try using cvBlobslib library...it has functions that gives the area of the blobs...here u cn consider the white patches as blobs on a black backgruond(..the border lines..)..opencv.willowgarage.com/wiki/cvBlobsLib Sep 3, 2012 at 2:09

1 Answer 1

0

The function floodFill can also return an area as its return value. So one thing you can do is to raster scan each pixel: each time you reach untouched pixel, colour it into some colour(black), and store the area of that region along with the pixel coordinates, continue until whole image would not be covered.

In the end you will have a set of areas with cordinates for one pixel in each region.

Will you need to recover specific region you can use floodFill again by colouring that region to a specific colour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.