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

  • SEARCH
  • Home
  • 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 8958967

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:20:20+00:00 2026-06-15T15:20:20+00:00

I have now been trying for hours to figure out what is wrong in

  • 0

I have now been trying for hours to figure out what is wrong in XCode when i try to use findContours. Basically this is my code:

#include <opencv2/opencv.hpp>
int main()
{
    Mat img = imread(helper::getImageSequence(3, image_value_temp));
    Mat img_gray = Mat(Size(img.cols, img.rows), CV_8UC1);
    Mat img_canny;

    cvtColor(img, img_gray, CV_BGR2GRAY);    

    Canny(img_gray, img_canny, someLow, someHigh);

    vector<vector<cv::Point> > contours;
    vector<Vec4i> hierarchy;
    findContours(img_canny, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE);
}

When i print contours i get 7905747460161236409, so i wonder if my heap is overflowing?

  • XCode version: 4.5.2
  • Compiler: Apple LLVM 4.1

So basically the crash traces back to findContours and this is all XCode gives me:

enter image description here

  • 0 0 Answers
  • 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-15T15:20:21+00:00Added an answer on June 15, 2026 at 3:20 pm

    It would be easier to recreate your error if you would provide the full source code and the image that produce this error for you. When I complete your code, so that I can use it:

    #include <opencv2/opencv.hpp>
    int main()
    {
        using namespace cv;
        Mat img = imread("test.png");
        Mat img_gray = Mat(Size(img.cols, img.rows), CV_8UC1);
        Mat img_canny;
    
        cvtColor(img, img_gray, CV_BGR2GRAY);    
    
        Canny(img_gray, img_canny, 80, 120);
    
        vector<vector<cv::Point> > contours;
        vector<Vec4i> hierarchy;
        findContours(img_canny, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE);
    }
    

    It runs fine on my system. I do not see a reason why it should not.
    The error you posted in the screenshot is not a compiler crash. Your debugger shows that your program crashed during executation.
    You have a function circle_fitting_callback obviously written by yourself that produces an error while destructing a vector of cv::points. Your problem is not in the code you posted but in something you are not showing to us.
    The best thing would be to learn to use your debugger. I do not know your IDE, but I guess it directly you to the part of your function causing the crash if you click the appropriate line in the call stack (the thing you showed to us).
    If you get stuck with this please post a complete code to reproduce the error.

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

Sidebar

Related Questions

Im stuck, been trying to figure this out for 2 hours now. I have
I have been spending the last hours trying to figure this out and now
I have been trying for hours now to figure out this regex and it
I have been trying to figure out this query for a few hours now
Been trying to figure this out for a couple of hours now and have
I'm a rails beginner and have been several hours now trying to figure out
I've been trying to figure this out for hours now, and I'm at my
Been sitting here for hours now trying to figure this out, so a bit
I've been trying to figure this out for a few hours now. In order
ive been trying to figure this out for 2 hours now and i cant

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.