Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv-3.2.0(x64): drawContours does not work

Hello,

I builded opencv 3.2.0 for x64 and try to use function drawContours, but it does not work. The code below.

Mat Mask;
const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };
const vector< vector<Point> >  co_ordinates = { obj_corners };
drawContours(Mask, co_ordinates, 0, Scalar(255), CV_FILLED);

The problem is that drawContours completes before it do something.

The source part of drawContours below.

void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
               int contourIdx, const Scalar& color, int thickness,
               int lineType, InputArray _hierarchy,
               int maxLevel, Point offset ){
CV_INSTRUMENT_REGION()

Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;

size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;

if( !last )
    return;

Variable last is false and drawContours complete. I found out that problem is method total() - it returns zero. The code below works exactly the same - ncount equal zero.

const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };       
const vector< vector<Point> >  co_ordinates = { obj_corners };
InputArrayOfArrays con = co_ordinates;
size_t ncount = con.total();

In x86 verson of opencv all works fine. What I do wrong?

opencv-3.2.0(x64): drawContours does not work

Hello,

I builded opencv 3.2.0 for x64 and try to use function drawContours, but it does not work. The code below.

Mat Mask;
const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };
const vector< vector<Point> >  co_ordinates = { obj_corners };
drawContours(Mask, co_ordinates, 0, Scalar(255), CV_FILLED);

The problem is that drawContours completes before it do something.

The source part of drawContours below.

void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
               int contourIdx, const Scalar& color, int thickness,
               int lineType, InputArray _hierarchy,
               int maxLevel, Point offset ){
CV_INSTRUMENT_REGION()

Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;

size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;

if( !last )
    return;

Variable last is false and drawContours complete. I found out that problem is method total() - it returns zero. The code below works exactly the same - ncount equal zero.

const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };       
const vector< vector<Point> >  co_ordinates = { obj_corners };
InputArrayOfArrays con = co_ordinates;
size_t ncount = con.total();

In x86 verson of opencv all works fine. What I do wrong?

UPDATE: I am using Win7(x64) and VC14. I try to use standart build of opencv from archive opencv-3.2.0-vc14.exe and result the same.

opencv-3.2.0(x64): drawContours does not work

Hello,

I builded opencv 3.2.0 for x64 and try to use function drawContours, but it does not work. The code below.

Mat Mask;
 Mask = Mat(rows, cols, CV_8UC1, cv::Scalar(255));
const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };
const vector< vector<Point> >  co_ordinates = { obj_corners };
drawContours(Mask, co_ordinates, 0, Scalar(255), CV_FILLED);

The problem is that drawContours completes before it do something.

The source part of drawContours below.

void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
               int contourIdx, const Scalar& color, int thickness,
               int lineType, InputArray _hierarchy,
               int maxLevel, Point offset ){
CV_INSTRUMENT_REGION()

Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;

size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;

if( !last )
    return;

Variable last is false and drawContours complete. I found out that problem is method total() - it returns zero. The code below works exactly the same - ncount equal zero.

const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };       
const vector< vector<Point> >  co_ordinates = { obj_corners };
InputArrayOfArrays con = co_ordinates;
size_t ncount = con.total();

In x86 verson of opencv all works fine. What I do wrong?

UPDATE: I am using Win7(x64) and VC14. I try to use standart build of opencv from archive opencv-3.2.0-vc14.exe and result the same.

opencv-3.2.0(x64): drawContours does not work

Hello,

I builded opencv 3.2.0 for x64 and try to use function drawContours, but it does not work. The code below.

 Mask = Mat(rows, cols, CV_8UC1, cv::Scalar(255));
cv::Scalar(0));
const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };
const vector< vector<Point> >  co_ordinates = { obj_corners };
drawContours(Mask, co_ordinates, 0, Scalar(255), CV_FILLED);

The problem is that drawContours completes before it do something.

The source part of drawContours below.

void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
               int contourIdx, const Scalar& color, int thickness,
               int lineType, InputArray _hierarchy,
               int maxLevel, Point offset ){
CV_INSTRUMENT_REGION()

Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;

size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;

if( !last )
    return;

Variable last is false and drawContours complete. I found out that problem is method total() - it returns zero. The code below works exactly the same - ncount equal zero.

const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };       
const vector< vector<Point> >  co_ordinates = { obj_corners };
InputArrayOfArrays con = co_ordinates;
size_t ncount = con.total();

In x86 verson of opencv all works fine. What I do wrong?

UPDATE: I am using Win7(x64) and VC14. I try to use standart build of opencv from archive opencv-3.2.0-vc14.exe and result the same.

opencv-3.2.0(x64): drawContours does not work

Hello,

I builded opencv 3.2.0 for x64 and try to use function drawContours, but it does not work. The code below.

 Mask = Mat(rows, cols, CV_8UC1, cv::Scalar(0));
const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };
const vector< vector<Point> >  co_ordinates = { obj_corners };
drawContours(Mask, co_ordinates, 0, Scalar(255), CV_FILLED);

The problem is that drawContours completes before it do something.

The source part of drawContours below.

void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
               int contourIdx, const Scalar& color, int thickness,
               int lineType, InputArray _hierarchy,
               int maxLevel, Point offset ){
CV_INSTRUMENT_REGION()

Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;

size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;

if( !last )
    return;

Variable last is false and drawContours complete. I found out that problem is method total() - it returns zero. The code below works exactly the same - ncount equal zero.

const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };       
const vector< vector<Point> >  co_ordinates = { obj_corners };
InputArrayOfArrays con = co_ordinates;
size_t ncount = con.total();

In x86 verson of opencv all works fine. What I do wrong?

UPDATE: I am using Win7(x64) and VC14. I try to use standart build of opencv from archive opencv-3.2.0-vc14.exe and result the same.same. image description

opencv-3.2.0(x64): drawContours does not workwork with Qt5

Hello,

I builded opencv 3.2.0 for x64 and try to use function drawContours, but drawContours in my Qt5 concole application, and it does not work. The code below.

 Mask = Mat(rows, cols, CV_8UC1, cv::Scalar(0));
const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };
const vector< vector<Point> >  co_ordinates = { obj_corners };
drawContours(Mask, co_ordinates, 0, Scalar(255), CV_FILLED);

The problem is that drawContours completes before it do something.

The source part of drawContours below.

void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
               int contourIdx, const Scalar& color, int thickness,
               int lineType, InputArray _hierarchy,
               int maxLevel, Point offset ){
CV_INSTRUMENT_REGION()

Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;

size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;

if( !last )
    return;

Variable last is false and drawContours complete. I found out that problem is method total() - it returns zero. The code below works exactly the same - ncount equal zero.

const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };       
const vector< vector<Point> >  co_ordinates = { obj_corners };
InputArrayOfArrays con = co_ordinates;
size_t ncount = con.total();

In x86 verson of opencv all works fine. What I do wrong?

UPDATE: I am using Win7(x64) and VC14. I try to use standart build of opencv from archive opencv-3.2.0-vc14.exe and result the same. image description

opencv-3.2.0(x64): drawContours does not work with Qt5

Hello,

I builded opencv 3.2.0 for x64 and try to use function drawContours in my Qt5 concole application, and it does not work. The code below.

 Mask = Mat(rows, cols, CV_8UC1, cv::Scalar(0));
const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };
const vector< vector<Point> >  co_ordinates = { obj_corners };
drawContours(Mask, co_ordinates, 0, Scalar(255), CV_FILLED);

The problem is that drawContours completes before it do something.

The source part of drawContours below.

void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
               int contourIdx, const Scalar& color, int thickness,
               int lineType, InputArray _hierarchy,
               int maxLevel, Point offset ){
CV_INSTRUMENT_REGION()

Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;

size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;

if( !last )
    return;

Variable last is false and drawContours complete. I found out that problem is method total() - it returns zero. The code below works exactly the same - ncount equal zero.

const vector<Point> obj_corners = { Point(x_bgn, y_bgn), Point(x_end, y_bgn), Point(x_end, y_end), Point(x_bgn, y_end) };       
const vector< vector<Point> >  co_ordinates = { obj_corners };
InputArrayOfArrays con = co_ordinates;
size_t ncount = con.total();

In x86 verson of opencv all works fine. What I do wrong?

UPDATE: I am using Win7(x64) and VC14. I try to use standart build of opencv from archive opencv-3.2.0-vc14.exe and result the same. image descriptionUPDATE2: Problem solved. In Debug configuration of my test project uses /MD key instead of /MDd(Project->Properties->C/C++->Code Generation->Runtime Library).