Why bitwise_and does not compute intersection? [closed]

asked 2014-07-18 06:53:40 -0500

thdrksdfthmn gravatar image

I have written this lines of code:

cv::Mat maskC(m_imgSize, CV_8UC1, cv::Scalar::all(0));
cv::Mat maskPC(m_imgSize, CV_8UC1, cv::Scalar::all(0));
cv::Mat maskIntersection(m_imgSize, CV_8UC1, cv::Scalar::all(0));

cv::imshow("maskC", maskC);
cv::imshow("maskPC", maskPC);
cv::imshow("maskIntersection", maskIntersection);
cv::waitKey();

PointVector contourCvx = convexingContour(contourIn);
PointVector plateContourCvx = convexingContour(plateContourIn);

cv::fillConvexPoly(maskC, contourCvx, cv::Scalar::all(255));
cv::fillConvexPoly(maskPC, plateContourCvx, cv::Scalar::all(255));
cv::bitwise_and(maskC, maskPC, maskIntersection);

double mi=-1, ma=-1;
cv::minMaxLoc(maskIntersection, &mi, &ma, 0, 0);
std::cerr << "(min,max) = (" << mi << "," << ma << ") ";

cv::imshow("maskC", maskC);
cv::imshow("maskPC", maskPC);
cv::imshow("maskIntersection", maskIntersection);
cv::waitKey();

But the maskIntersection is not changed; it is still a zero matrix. The standard output is displaying: (min,max) = (0, 0) every time.

Why bitwise_and does not return the intersection of the two: maskC and maskPC?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Witek
close date 2014-07-18 15:21:37.924896

Comments

Sorry, I have forgot to add the offset to the contours... please close it

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-07-18 07:10:03 -0500 )edit