Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Error when get color from pixel in visual studio C++

$
0
0
This is function to get the color from a given Mat image, string getColorFromPx(Mat *src, uint16_t x, uint16_t y){ Point pt = Point(x, y); //Mat img = (*src).clone(); Vec3b& levelPxImg = imgHSV.at(y, x); if ((levelPxImg[0] != NULL) && (levelPxImg[1] != NULL) && (levelPxImg[2] != NULL)){ //H(openCV) / 2 = H (HSV_Real); if (levelPxImg[0] > 170 && levelPxImg[0] < 180) return "R"; else if (levelPxImg[0] > 107 && levelPxImg[0] < 122) return "B"; else return "xx"; } } the program can work for a period time after that it notify an error as below: " First-chance exception at 0x00007FF64C1C30A3 in OpenCVex1.exe: 0xC0000005: Access violation reading location 0x0000000000000018. If there is a handler for this exception, the program may be safely continued. " and current breakpoint is halted at return line as below: int compare(const _Elem *_Ptr) const {// compare [0, _Mysize) with [_Ptr, ) _DEBUG_POINTER(_Ptr); -------> return (compare(0, this->_Mysize, _Ptr, _Traits::length(_Ptr))); } (this function locate in VS/include/xstring file). Please take a look and help me to show problem.

Viewing all articles
Browse latest Browse all 19555

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>