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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:23:05+00:00 2026-06-17T23:23:05+00:00

I need to copy my image data from one Mat another Mat. My code

  • 0

I need to copy my image data from one Mat another Mat. My code look like below

Mat src; // Source image
Mat res(1024,768,CV_8UC3); //Same width and height as source
uchar *dest=src.data;
res.data=dest;

But I am getting distorted destination image. Is it my coding problem?

Thanks in advance!

  • 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-17T23:23:06+00:00Added an answer on June 17, 2026 at 11:23 pm

    But I am getting distorted destination image. Is it my coding problem?

    If width and height is the same than it seems that problem is with number of channels (number of bytes per pixel). Try to change CV_8UC3 to CV_8UC1.

    And also your code doesn’t copy data, it copies pointers. Read documentation about memcpy.

    Actually you should use method clone of cv::Mat:

    // returns deep copy of the matrix, i.e. the data is copied
        Mat clone() const;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to copy a jar file from one directory to another when my
I need to copy a value of an image column from one row to
I need to simply copy copy images (ul>li>img) from one container to other with
I need to copy files in one directory to another directory where the lastwritetime
This topic is related to Copy missing rows from one table to another in
I need to copy a node and its sub-nodes: first: one identical copy followed
following code i used to retrieve Image from database through linq query but i
I've trying to get byte-array and copy from there to another array some rows
I am using opencv for a certain image processing code. I need to extract
I want to use some prepared selectors from AndroidSDK_HOME/platforms/API/data/res/drawable but I'm not sure what

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.