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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:18:08+00:00 2026-06-12T01:18:08+00:00

I am trying to read video frames in OpenCV, then copy the data into

  • 0

I am trying to read video frames in OpenCV, then copy the data into my another C++ code to perform something else. My code is as follows:

cv::Mat capturedFrame; 
int newData[600][800];
std::cout<<"Debug1 " << std::endl;
memcpy((char*)newData, (char*)capturedFrame.data, 600*800*sizeof(int) );
std::cout<<"Debug2 " << std::endl;
mycode.setData ( newData );
std::cout<<"Debug3 " << std::endl;

Then the class “setData” was defined as follows:

char data [600][800];
void mycode::setData ( char newData[600][800] )
{
  for ( int m=0; m < 600; m ++ )
  {
      for ( int n = 0; n < 800; n ++ )
      {
          data[i][j] = newData[i][j]; 
      }
  }
}

But the code stops when it comes to the line:

    mycode.setData ( newData );

What confuses me is, if I delete this code, then I can see “Debug1” to “Debug3” on the screen, which is normal. But if I use this code, the program stops even without printing out “Debug1” and “Debug2” on the screen. This is really strange. I also tried to comment out all the lines in the “setData” class to make it be an empty class, but the error still is the same. So I believe it was not about the “setData” class.
I also know that the “capturedFrame.data” was correct, because I performed some other filters on it, and the result was good. Can someone explain the error here?

Edit:

I used a debugger, but there was no error message but the program just stopped responding. Also, I changed the data type into “char”.

  • 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-12T01:18:09+00:00Added an answer on June 12, 2026 at 1:18 am

    This array:

    int newData[600][800];
    

    is larger than 1 MB. If this is a local variable, then you’re likely blowing the stack.

    The same may go for the data array, but since your code snippets have very little context, it’s hard to know what might be statically allocated vs. automatically allocated.

    I think you should consider dynamically allocating these large arrays.

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

Sidebar

Related Questions

I am currently trying to read in video frames by using FFMPEG. The format
I'm trying to do VideoCapture cap (../video.avi); Getting an error: Couldn't read movie file
I am trying to read some XML code from a website, and am having
I'm just trying to read a video Stream out of an IP Camera (Basler
I am trying to write a c++ program that would read key frames from
I'm trying to threshold red pixels in a video stream using OpenCV. I have
I've been trying to write a video+audio using AVAssetWriter and AVAssetWriterInputs. I read multiple
I am trying to write a video processing application using OpenCV 2.4.2 (in Visual
I'm trying to read MXF files (from Avid) into an Objective-C project and analyze
I am trying to process a video by playing with its frames via the

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.