2 different CvImagePtr, 2 windows give assertion error
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
http://answers.ros.org/
found that the assertion problem is with "CvImagePtr->image = Mat", not in the shown code.
Ok, solved by ptr1 = ptr2.