Unhandled exception from opencv_core249.dll when returning main end
Hi. I've created a recognition system's stages and it's fine until I load an image which has different width of the others (first ones have small width than 1000 pixels with no error but last three ones have bigger width than 1000 pixels) then I faced a problem and I've opened a topic on stackoverflow (here is link). I thought it was about std::vector
problem but now I'm confused because I've solved (I think) std::vector
problem with pointerrs but now unhandled exception is occuring when whole process is trying to end with end of main
returning. The error is occuring at system.cpp
in int _interlockedExchangeAdd(int* addr, int delta){...}
and the code is some big. I don't know which part of code cause this and I don't know again how can I handle this exception with try/catch
or any other method. If anyone give any advice I'm here. Thanks.
Unhandled exception at 0x0F2EE189 (opencv_core249d.dll) in pt_dll_deneme.exe: 0xC0000005: Access violation writing location 0x000006BA.
Edit: 1. Small code sample
struct ExtremumPoints_t
{
std::vector<int> maxPoints;
std::vector<int> minPoints;
unsigned int maxCnt;
unsigned int minCnt;
};
struct ImageClipping_t
{
int bm;
int b0;
int b1;
cv::Mat ROI;
};
ExtremumPoints_t *exPoints;
ImageClipping_t *vecClippingB;
ImageClipping_t *vecClippingP;
myClass::myClass()
{
exPoints = new ExtremumPoints_t();
vecClippingB = new ImageClippint_t();
vecClippingP = new ImageClippint_t();
}
myClass::~myClass()
{
delete exPoints;
delete vecClippingB;
delete vecClippingP;
}
void myClass::findExtremums(cv::Mat &pr)
{
// using wite exPoints..
// some if else statements to find extremum points in a one dimensional cv::Mat array
// these can be seen at link at details
}
void myClass::processExtremums(cv::Mat &im, cv::Mat &pr)
{
// using exPoints and clippingB finding some ROI's or full image
findExtremums(pr);
// these are if .. else statements again
// extremum points no longer needed so can be cleared
exPoints->minPoints.clear();
exPoints->maxPoints.clear();
}
void myClass::processClippingB(cv::Mat &im)
{
// using new ROI's in clippingP from clippingB
// some process about finding actual object pixel points
// finding new extremum points from created new ROIs
// exPoints, clippingB and clippingP are no longer needed
exPoints->minPoints.clear();
exPoints->minPoints.clear();
clippingB->clear();
clippingP->clear();
}
Processes are not complex just find min or max value then save the pixel index and find roi of image. All processes
simple and working. First there was a vector problem and I've write it to stackoverflow now unhandled exception occuring last return 0; line in main function