Updated by Alexander Shishkov almost 13 years ago

Here is test application source

<pre><code class="cpp"> <pre>
#include <opencv2/core/core.hpp>
#include <vector>

using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{
vector<Point> line1;
vector<Point> line2;

line1.push_back(Point(1, 1));
line1.push_back(Point(5, 1));
line1.push_back(Point(5, 8));
line1.push_back(Point(1, 8));

line2.push_back(Point(2, 2));
line2.push_back(Point(10, 2));
line2.push_back(Point(10, 16));
line2.push_back(Point(2, 16));

Mat gray0(10,10,CV_8U, Scalar(0));

fillConvexPoly(gray0, line1, Scalar(255), 8, 0);

int nz1 = countNonZero(gray0);

fillConvexPoly(gray0, line2, Scalar(0), 8, 1);

int nz2 = countNonZero(gray0);

printf("before: %d, after: %d\n", nz1, nz2);
//expected - before: 40, after: 0
//actual - before: 40, after: 5

return 0;
}
</code></pre> </pre>

Back