Home > Back-end >  OpenCV 0 x00007fff91e93b29 caused by abnormal: Microsoft C anomalies
OpenCV 0 x00007fff91e93b29 caused by abnormal: Microsoft C anomalies

Time:09-25


Error:
OpenCV Error: an Assertion failed (((((sizeof (size_t) & lt; <28) | 0 x8442211) & gt;> ((traits: : Depth


After running to generate interrupts, jump to the code
CV_DbgAssert (CV_ELEM_SIZE1 (traits: : Depth
Don't know where is the problem solved!!!!!!!!!!


My code is as follows:

Mat regionGrowFast (const Mat & amp; The SRC, const Point2i seed, int throld)
{
//convert the SRC to gray for getting gray value of every pixel
Mat gray;
CvtColor (SRC, gray, COLOR_RGB2GRAY);

//set every pixel to black
Mat result=Mat: : zeros (SRC) size (), CV_8UC1);
If ((seed. X & lt; 0) | | (seed. Y & lt; 0))
return result;
Result. At (seed. Y, seed. X)=255;

//gray value of seed
int seed_gray=gray. At (seed. Y, seed. X); //display in the sentence suspended!
//turns direction sequenc
Int grow_direction [8] [2]={{1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, 1}, {0, 1}, {1, 1}, {1, 0}};
//seeds collection
VectorSeeds. The push_back (seed);

//start growing
while (! Seeds. The empty ()) {
//get a seed
Point2i current_seed=seeds. The back ();
Seeds. Pop_back ();

for (int i=0; i <8; + + I) {
Point2i neighbor_seed (current_seed. X + grow_direction [0], [I] current_seed. Y + grow_direction [I] [1]).
//check wether image in
If (neighbor_seed. X & lt; 0 | | neighbor_seed. Y & lt; 0 | | neighbor_seed. X & gt; (gray. The cols - 1) | | (neighbor_seed. Y & gt; Gray. The rows - 1))
continue;
Int value=https://bbs.csdn.net/topics/gray.at (neighbor_seed. Y, neighbor_seed. X);
If (result. At (neighbor_seed. Y, neighbor_seed. X)==0) & amp; & (abs (value - seed_gray) & lt;={throld))
Result. At (neighbor_seed. Y, neighbor_seed. X)=255;
Seeds. The push_back (neighbor_seed);
}
}
}
return result;
}



Int main ()
{
Mat src=https://bbs.csdn.net/topics/GDAL2Mat (" wh02changedetect1. Img ");

Point2i pt=Point2i (300, 400);
Mat out=regionGrowFast (SRC, pt, 50);
Imwrite (" D: \ \ output. BMP, out);


The delete [] data02;

system("pause");
return 0;
}

  • Related