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
//gray value of seed
int seed_gray=gray. At
//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
Vector
//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
If (result. At
Result. At
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;
}