Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:56:16+00:00 2026-06-07T19:56:16+00:00

I just wrote a little program which searches for contours in a color thresholded

  • 0

I just wrote a little program which searches for contours in a color thresholded binary image which is processed with canny after thresholding, but somehow it always finds two contours for every object in the image.

In the bottom right image where the found contours are drawn, you can see that the biggest contour is drawn two times with a little offset between the two contours. The next image shows a detailed view of this image.

http://img831.imageshack.us/img831/3641/doubleframe2.png

Here just the biggest contour is drawn two times, but it happens randomly for every other one of the contours.
I just want one contours for every object, how can i achieve that? :/

Update:

The size of the contours vector which is filled by the findContours method has a size of 8 where it should have a size of just 4.

update 2:

Here is the rgb input image from the kinect
http://img405.imageshack.us/img405/9761/inputimage.jpg
for the color Threshold i used the following approach

cv::cvtColor(in, out, CV_BGR2HSV);
cv::inRange(out,
            cv::Scalar(25, 131, 97),
            cv::Scalar(35, 220, 217),
            out);

followed by an erosion + dilation with an rect element with a size of 1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:56:17+00:00Added an answer on June 7, 2026 at 7:56 pm

    I think the problem is most likely because when you find the edges and then find the contours of those edges, there is an outer boundary and inner boundary for it. So openCV take both as contours and draw it.

    When I calculated its areas, they have a very minor changes of a value of around ‘3’ ( for example, biggest square has detected two contours with areas 9105.5 and 9108.5 ), which is most likely to happen due to the reason I mentioned. (So they are very difficult to distinguish)

    The problem can be solved if you find contours with out finding canny edges. ie directly find the contours from thresholded image. It will give you more accurate answer.

    In first case(after canny), I got 36 contours while in second case, i got only 22 contours.

    Try it and hope it solves the problem !!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wrote a little program which will be executed as a post-build step
I wrote a little Python script wrapcl.py script which wraps our compiler binary (
I just wrote a program to calculate employee's pay rates. To me, the program
I need a little program which: Reads natural number n then reads n real
I'm trying to write a program that is just a little beyond my abilities.The
I was wrote a little scratch program to check the time of looping through
I wrote a little test program to show here. Here is the source code.
I'm just starting out with the Scala and am trying a little toy program
I came across something really weird when I wrote a little lotto program in
I have a program which I wrote in Java using Eclipse and then put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.