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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:10:58+00:00 2026-05-26T16:10:58+00:00

So, I am writing some OpenCV C++ code and I am having trouble porting

  • 0

So, I am writing some OpenCV C++ code and I am having trouble porting my code from OpenCV 2.2 to 2.3.1. The main problem right now is the Mat::copyTo function. In the documentation or the release notes, they have mentioned that while the new version of this function takes OutputArray, the old code should still work (i.e., Mat::copyTo(Mat &m)). The thing is that it does not work.

Here’s my code

void copyMatRows(Mat &src,Mat &dest,int start_pos)
{
    for(int i=0; i < src.rows;i++)
    {
        int dest_y = start_pos;

        if(start_pos < 1)
        {
            dest_y = dest_y+i;
        }
        src.row(i).copyTo(dest.row(dest_y));

    }
}

So in the above code the line

src.row(i).copyTo(dest.row(dest_y));

fails with the error

no matching function for call to cv::Mat::copyTo(cv::Mat) candidates
are: void cv::Mat::copyTo(const cv::_OutputArray&) const

Any help would be appreciated? any way in which i can fix this?

What I am trying to do is to get N number of matrices and combine them all in one big matrix.

  • 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-26T16:10:59+00:00Added an answer on May 26, 2026 at 4:10 pm

    This should fix your function, but I’m not sure it’s doing exactly what you want:

    void copyMatRows(Mat &src, Mat &dest, int start_pos)
    {
        for(int i = 0; i < src.rows; i++)
        {
            int dest_y = start_pos;
    
            if(start_pos < 1)
            {
                dest_y = dest_y + i;
            }
    
            Mat destRow = dest.row(dest_y);
            src.row(i).copyTo(destRow);
        }
    }
    

    EDIT :
    This should do pretty much what you’re looking for:

    void appendMatRows(Mat &src, Mat &dst, int start_pos)
    {
        for(int i = start_pos; i < src.rows; i++)
        {
            dst.push_back(src.row(i));
        }
    }
    

    The main caveat with the push_back member function is that the number of columns must be the same, but I don’t think you’re too worried about that.

    Hope that helps!

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

Sidebar

Related Questions

I am writing a function that takes a OpenCV Mat structure and does some
I've been writing some code that extracts the main textual content from web pages.
I have some trouble writing some code (I might be tired), so I need
I am currently writing some extensions in twig, but I am having trouble deciding
While writing some C code, I decided to compile it to assembly and read
I am writing some code to determine whether a network domain is registered. For
So I was writing some code today that basically looks like this: string returnString
Say I'm writing some ruby code and I want to use the standard Date
I'm writing some semi-portable code and want to be able to detect when I'm
i've been writing some OpenCL code lately on linux (ubuntu 10.4, ati catalyst 10.4

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.