Ask Your Question

Revision history [back]

Throwing an error when scanning pixels in an image

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)="" &gt;="" 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]); } } }

Throwing an error when scanning pixels in an image

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)="" &gt;="" 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]); } } }

Throwing an error when scanning pixels in an image

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> 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)="" &gt;="" 0)="" point="" is="" inside="" {="" cvgcolor="" cvgpixel(matcropped.at<cv::vec3b="">(i, 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, matCropped.at<cv::Vec3b>(i, j)[1], matCropped.at<cv::vec3b>(i, matCropped.at<cv::Vec3b>(i, j)[0]); } } }

}

Throwing an error when scanning pixels in an image

I'm getting this error: error:

error: (-215) dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] && (unsigned)(i1DataType<_Tp>::channels) (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]channels()) (unsigned)(size.p[1]*channels()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3) - 1))*4) & 15) == elemSize1()

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]);
      }
    }
}