First time here? Check out the FAQ!

Ask Your Question
0

Iterating over contours of an Image in Java

asked Jun 9 '15

ElsayedAwd gravatar image

please how I can Iterate over a list of Contours of an Image in Java for Android . many thanks

Preview: (hide)

Comments

1

e.g. look at the android samples

berak gravatar imageberak (Jun 9 '15)edit

thanks a lot

ElsayedAwd gravatar imageElsayedAwd (Jun 9 '15)edit

1 answer

Sort by » oldest newest most voted
0

answered Jun 9 '15

iamprivate gravatar image

Do you mean something like this

 Imgproc.findContours(temp, contours, new Mat(),Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_NONE);

     for(int i =0;i<contours.size();i++)
     {
         // do something 
     }
Preview: (hide)

Comments

you are right but I would to Iterate over the contours to remove some contours

ElsayedAwd gravatar imageElsayedAwd (Jun 10 '15)edit

You can for example ignore some based on their area

if(Imgproc.contourArea(contours.get(i))>max) { // add bigger contours to new list }

iamprivate gravatar imageiamprivate (Jun 10 '15)edit

thanks a lot

ElsayedAwd gravatar imageElsayedAwd (Jun 13 '15)edit

Question Tools

1 follower

Stats

Asked: Jun 9 '15

Seen: 519 times

Last updated: Jun 09 '15