Ask Your Question

Revision history [back]

Memory leaking c++ w/VS12

Hello everyone,

I am trying to create a simple program to load an image (6398*1080) and have it shown the portion of monitor by defining a sub-image, and the location of sub-image will be changing regarding to time This is to create the motion of image-sliding, just like the sliding animation in power point. However, there seems to be an memory leaking and crashes at halfway of the program (the beginning part is fine), the error is "Unhandled exception at at 0x00007FFBDAB8A388 in opencv.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000005E07F7F5F0.". Your help are very appreciated!! The code is here.

include <opencv2\core\core.hpp>

include <opencv2\highgui\highgui.hpp>

include <iostream>

using namespace cv; using namespace std;

int main( ) {

   Mat image = imread("Image1.jpg", CV_LOAD_IMAGE_COLOR);   
   for(int i=0;i<4478;i++)
   {
   Mat subImage(image, cv::Rect(i, 0, 1920+i,1080));
    //DISPLAY image
   namedWindow( "window",CV_WINDOW_NORMAL);
   setWindowProperty("window", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
   moveWindow("window", 1919,0);
   imshow( "window", subImage ); 

   waitKey(1);                       
   }
   return 0;

}

Memory leaking c++ w/VS12

Hello everyone,

I am trying to create a simple program to load an image (6398*1080) and have it shown the portion of monitor by defining a sub-image, and the location of sub-image will be changing regarding to time This is to create the motion of image-sliding, just like the sliding animation in power point. However, there seems to be an memory leaking and crashes at halfway of the program (the beginning part is fine), the error is "Unhandled exception at at 0x00007FFBDAB8A388 in opencv.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000005E07F7F5F0.". Your help are very appreciated!! The code is here.

include <opencv2\core\core.hpp>

include <opencv2\highgui\highgui.hpp>

include <iostream>

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <iostream> 
using namespace cv; 
using namespace std; 

int main( ) {

{

       Mat image = imread("Image1.jpg", CV_LOAD_IMAGE_COLOR);   
    for(int i=0;i<4478;i++)
    {
    Mat subImage(image, cv::Rect(i, 0, 1920+i,1080));
     //DISPLAY image
    namedWindow( "window",CV_WINDOW_NORMAL);
    setWindowProperty("window", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
    moveWindow("window", 1919,0);
    imshow( "window", subImage ); 

    waitKey(1);                       
    }
    return 0;
}

}