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 6540701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:00:41+00:00 2026-05-25T11:00:41+00:00

Input Image — https://i.stack.imgur.com/hIqEd.png Output Image with Convex Hull of contours drawn — https://i.stack.imgur.com/pEKPP.png

  • 0

Input Image — https://i.stack.imgur.com/hIqEd.png
Output Image with Convex Hull of contours drawn — https://i.stack.imgur.com/pEKPP.png

Also any help on how to get one contour will be much appreciated?

  • 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-05-25T11:00:41+00:00Added an answer on May 25, 2026 at 11:00 am

    The trick to retrieve the image as one contour seems to be processing the image with Canny before executing cvFindContours.

    IplImage* src = cvLoadImage(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
    
    IplImage* cc_img = cvCreateImage( cvGetSize(src), src->depth, 3 );
    cvSetZero(cc_img);
    CvScalar(ext_color);
    
    CvMemStorage *mem;
    mem = cvCreateMemStorage(0);
    CvSeq *contours = 0;
    
    // edges returned by Canny might have small gaps between them, which causes some problems during contour detection
    // Simplest way to solve this s to "dilate" the image.
    cvCanny(src, src, 10, 50, 3); 
    cvShowImage("Tutorial", src);
    cvWaitKey(0);
    
    int n = cvFindContours( src, mem, &contours, sizeof(CvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0));
    
    CvSeq* ptr = 0;
    for (ptr = contours; ptr != NULL; ptr = ptr->h_next)
    {   
        ext_color = CV_RGB( rand()&255, rand()&255, rand()&255 ); //randomly coloring different contours
        cvDrawContours(cc_img, ptr, ext_color, CV_RGB(0,0,0), -1, CV_FILLED, 8, cvPoint(0,0));
    }   
    
    cvNamedWindow("Tutorial");
    cvShowImage("Tutorial", cc_img);
    //cvSaveImage("out.png", cc_img);
    
    cvWaitKey(0);
    

    Outputs:

    enter image description here

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

Sidebar

Related Questions

So, I can create an input button with an image using <INPUT type="image" src="/images/Btn.PNG"
I want to convert the input 24 bit PNG image to 8 bit, I
Given a rectangular input image I'd like to create an output image of size
Got these two image buttons: <input type=image src=images/Update.png name=btnSubmit value=Update/> <input type=image src=images/Cancel.png value=Cancel
I have this html right now: <h1><span class = 'highlight'><input type='image' class='removeall' src='remove.png'> <input
I have a strange problem where an onclick event on an input image is
I have to buttons, image input that work fine when in the markup like
I am trying to append an image after the last input field in a
I'm generating a coupon based on dynamic input and a cropped image, and I'm
I found out how to generate an image in code-behind based on some input

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.