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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:37:48+00:00 2026-06-13T00:37:48+00:00

in my application i have a function which receives a cv::Mat object by reference.

  • 0

in my application i have a function which receives a cv::Mat object by reference.
here is function’s declaration:

     void getChains(cv::Mat &img,std::vector<chain> &chains,cv::Mat &ch,char p=0,int sx=0,int sy=0);

this function is recursive, and aaa is not really needed at the first call from the main function, so i just declared an empty aaa to pass it to the function call. in subsequent recursive calls function generates its own ch Mat objects.

std::vector<chain> chains1;
cv::Mat aaa();

getChains(bin1,chains1,aaa);

however, the compiler returns an error:

main.cpp:75: error: invalid initialization of non-const reference of type ‘cv::Mat&’ from a temporary of type ‘cv::Mat (*)()’
aux.h:21: error: in passing argument 3 of ‘void getChains(cv::Mat&, std::vector >&, cv::Mat&, char, int, int)’

if i change aaa declaration to

        cv::Mat aaa=cv::Mat();

it compiles without a problem.

the function is passed a binary image img and gets all the pixel groups in which pixels stick together (chains) and stores all the pixels’ coordinates in the chains vector. Is there perhaps already an existing function within openCV that does a similar thing?

thanks

  • 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-13T00:37:49+00:00Added an answer on June 13, 2026 at 12:37 am

    This is a function definition: cv::Mat aaa();. What you actually want to write is cv::Mat aaa;

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

Sidebar

Related Questions

I have a C# application, and I want to run a function which is
I have Java application which sends pointer to function (callback) to some native dll
I have an application in VC++ which needs to execute a function provided to
I have a MFC dialog based application in which I use ::system() function to
This is a Windows Forms application. I have a function which captures some mouse
In my Node.js application, I have a function (routed by Express) which presents a
I have an edit text which functions as a search box in my application.
My application has several independent top-level windows, which all have completely different functions/workflows. I
I have a function in my application that calls various subfunctions depending on the
I have a function in my nodejs application called get_source_at. It takes a uri

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.