I'm getting this error: error: (-215) dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] && (unsigned)(i1DataType<_Tp>::channels) < (unsigned)(size.p[1]channels()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3) - 1))*4) & 15) == elemSize1()
I'm scanning through an image to determine what color the pixels are inside a polygon. I'm completely stumped as to what is causing the error. Any assistance would be great.
This is the code that is throwing the error (CVGColor is just a structure to hold RGB values):
cv::Rect boundingRect = cv::boundingRect(aPolygon); cv::Mat matCropped = matImage(boundingRect); std::vector<cv::point> aPolygonTranslated; for(size_t i=0; i<apolygon.size(); i++)="" {="" apolygontranslated.push_back(cv::point(apolygon[i].x="" -="" boundingrect.x,="" apolygon[i].y="" -="" boundingrect.y));="" }="" for(int="" i="0;" i<matcropped.cols;="" i++)="" {="" for(int="" j="0;" j<matcropped.rows;="" j++)="" {="" if(cv::pointpolygontest(apolygontranslated,="" cv::point(i,="" j),="" false)="" >="" 0)="" point="" is="" inside="" {="" cvgcolor="" cvgpixel(matcropped.at<cv::vec3b="">(i, j)[2], matCropped.at<cv::vec3b>(i, j)[1], matCropped.at<cv::vec3b>(i, j)[0]); } } }