2 different CvImagePtr, 2 windows give assertion error

asked 2014-06-19 13:33:12 -0600

hvn gravatar image

Hi,

I have 2 different CvImagePtr, e.g. cv_ptr and cv_ptr_2, and 2 windows, e.g. imshow("window1",image1) and imshow("window2",image2) where image1 and image2 are both Mat. The code compiles fine, but executing ends in assertion 'px != 0' failed and core dump. But how do I publish 2 ptrs to their own window ? I have tried both in 1 try and 2 try's in succession with their own ptr.

Codepiece that goes well:

try
{
    cv::imshow(OPENCV_WINDOW, image_in_mat);
}
catch (cv::Exception& cv_ex)
{
    ROS_ERROR("cv exception: %s", cv_ex.what());
    return;
}
cv::waitKey(3);
image_pub.publish(cv_ptr->toImageMsg());

Thanks

edit retag flag offensive close merge delete

Comments

berak gravatar imageberak ( 2014-06-20 01:51:43 -0600 )edit

found that the assertion problem is with "CvImagePtr->image = Mat", not in the shown code.

hvn gravatar imagehvn ( 2014-06-20 03:30:42 -0600 )edit

Ok, solved by ptr1 = ptr2.

hvn gravatar imagehvn ( 2014-06-20 05:21:24 -0600 )edit