Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Segmentation fault when cv::Mat is constructed by Image buffer and not by VideoCapture::retreive

When I add to a buffer (a QQueue) a cv::MAT that gets acquired using function

Mat grabbedFrame;
videoCapture.retreive(grabbedFrame);

the image gets dequed and cloned just fine.

When I create a Mat using the constructor below

Mat PylonToOpenCvImage = cv::Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t *) pylonImage.GetBuffer());

trying to deque and clone gives a segmentation fault....

But Using

cv::imshow()

both images can be viewed....

What could be wrong?

regards

Segmentation fault when cv::Mat is constructed by Image buffer and not by VideoCapture::retreive

When I add to a buffer (a Qt QQueue) a cv::MAT that gets acquired using function

Mat grabbedFrame;
videoCapture.retreive(grabbedFrame);

the image gets dequed and cloned just fine.

When I create a Mat using the constructor below

Mat PylonToOpenCvImage = cv::Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t *) pylonImage.GetBuffer());

trying to deque and clone gives a segmentation fault....

But Using

cv::imshow()

both images can be viewed....

What could be wrong?

wrong? What are The differencies bettween the grabbedFrame vaiable ant the PylonToOpenCvImage one. regards

Segmentation fault when cv::Mat is constructed by Image buffer and not by VideoCapture::retreive

When I add to a buffer (a Qt QQueue) a cv::MAT that gets acquired using function

Mat grabbedFrame;
videoCapture.retreive(grabbedFrame);

the image gets dequed and cloned just fine.

When I create a Mat using the constructor below

Mat PylonToOpenCvImage = cv::Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t *) pylonImage.GetBuffer());

trying to deque and clone gives a segmentation fault....

But Using

cv::imshow()

both images can be viewed....

What could be wrong? What are The differencies bettween the grabbedFrame vaiable ant the PylonToOpenCvImage one. one.

The seg fault seems to be here

Mat Mat::clone() const
{
    Mat m;
    copyTo(m);
    return m;
}

at the copyTo(m) function from mat.inl.hpp. Although please don't take it forgranted

regards

Segmentation fault when cv::Mat is constructed by Image buffer and not by VideoCapture::retreive

When I add to a buffer (a Qt QQueue) a cv::MAT that gets acquired using function

Mat grabbedFrame;
videoCapture.retreive(grabbedFrame);

the image gets dequed and cloned just fine.

When I create a Mat using the constructor below

Mat PylonToOpenCvImage = cv::Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t *) pylonImage.GetBuffer());

trying to deque and clone gives a segmentation fault....

But Using

cv::imshow()

both images can be viewed....

What could be wrong? What are The differencies bettween differences between the grabbedFrame vaiable variable ant the PylonToOpenCvImage one.

The seg fault seems to be here

Mat Mat::clone() const
{
    Mat m;
    copyTo(m);
    return m;
}

at the copyTo(m) function from mat.inl.hpp. Although please don't take it forgranted

for granted

Additionally this is the error I get

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /build/opencv-iC2m9y/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp, line 522
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-iC2m9y/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp:522: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

regards

Segmentation fault when cv::Mat is constructed by Image buffer and not by VideoCapture::retreive

When I add to a buffer (a Qt QQueue) a cv::MAT that gets acquired using function

Mat grabbedFrame;
videoCapture.retreive(grabbedFrame);

the image gets dequed and cloned just fine.

When I create a Mat using the constructor below

Mat PylonToOpenCvImage = cv::Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t *) pylonImage.GetBuffer());

trying to deque and clone gives a segmentation fault....

But Using

cv::imshow()

both images can be viewed....

What could be wrong? What are The differences between the grabbedFrame variable ant the PylonToOpenCvImage one.

The seg fault seems to be here

Mat Mat::clone() const
{
    Mat m;
    copyTo(m);
    return m;
}

at the copyTo(m) function from mat.inl.hpp. Although please don't take it for granted

Additionally this is the error I get

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /build/opencv-iC2m9y/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp, line 522
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-iC2m9y/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp:522: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

regards

Segmentation fault when cv::Mat is constructed by Image buffer and not by VideoCapture::retreive

When I add to a buffer (a Qt QQueue) a cv::MAT that gets acquired using function

Mat grabbedFrame;
videoCapture.retreive(grabbedFrame);

the image gets dequed and cloned just fine.

When I create a Mat using the constructor below

Mat PylonToOpenCvImage = cv::Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t *) pylonImage.GetBuffer());

trying to deque and clone gives a segmentation fault....

But Using

cv::imshow()

both images can be viewed....

What could be wrong? What are The differences between the grabbedFrame variable ant the PylonToOpenCvImage one.

The seg fault seems to be here

Mat Mat::clone() const
{
    Mat m;
    copyTo(m);
    return m;
}

at the copyTo(m) function from mat.inl.hpp. Although please don't take it for granted

Also sometimes I get the following

what(): /build/opencv-iC2m9y/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp:522: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

regards

Segmentation fault when cv::Mat is constructed by Image buffer and not by VideoCapture::retreive

When I add to a buffer (a Qt QQueue) a cv::MAT that gets acquired using function

Mat grabbedFrame;
videoCapture.retreive(grabbedFrame);

the image gets dequed and cloned just fine.

When I create a Mat using the constructor below

Mat PylonToOpenCvImage = cv::Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t *) pylonImage.GetBuffer());

trying to deque and clone gives a segmentation fault....

But Using

cv::imshow()

both images can be viewed....

What could be wrong? What are The differences between the grabbedFrame variable ant the PylonToOpenCvImage one.

The seg fault seems to be here

Mat Mat::clone() const
{
    Mat m;
    copyTo(m);
    return m;
}

at the copyTo(m) function from mat.inl.hpp. Although please don't take it for granted

Also sometimes I get the following

what(): /build/opencv-iC2m9y/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp:522: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

regards