c++ - Error blending two images in OpenCV -
I want to see two images in between for RGB and depth change, this is my program, Makes it very easy to understand using the original
#include & lt; Ros / ros.h & gt; # Include & lt; Image_transport / image_transport.h & gt; #include & lt; Opencv / cv.h & gt; #include & lt; Opencv / highgui.h & gt; # Include & lt; Cv_bridge / cv_bridge.h & gt; #include & lt; Sensor_msgs / image_encodings.h & gt; Using namespace cv; Cv_bridge :: CvImagePtr cv_ptr_rgb; Zero imageCallbackrgb (static sensor_msgs :: ImageConstPtr & msg) {// cv_bridge :: CvImagePtr cv_ptr_rgb; Try {cv_ptr_rgb = cv_bridge :: toCvCopy (msg, sensor_msgs :: image_encodings :: MONO8); } Hold (cv_bridge :: exception & amp; A) {ROSS_ERROR ("CV_brivize exception:% s", e.w. ()); Return; } // cv :: imshow ("OpenCV Viewer Kinect RGB", cv_ptr_rgb-> Image); CvWaitKey (3); } Zero imageCallbackdepth (static sensor_msgs :: ImageConstPtr & amp; msg) {// convert Convert Messages from ROS to OpenCV cv_bridge :: CvImagePtr cv_ptr_depth; Try {cv_ptr_depth = cv_bridge :: toCvCopy (msg, sensor_ms gs :: image_encodings :: TYPE_16UC1); } Hold (cv_bridge :: exception & amp; A) {ROSS_ERROR ("CV_brivize exception:% s", e.w. ()); Return; 8UC / * conversion Sutffs * / / * // ************************* Conversion 16UC image ************************************************************************************************* ******************************* Double alpha = 0.5; Double beta; Beta = (1.0 - alpha); Mat dst; Adding (cv_print_rgb-> image, alpha, image_8cu, 0.5, 0.5, dst); Cv :: imshow ("Linear Blend", DST); // ************************************************************************************************* *************************** / CV :: imshow ("OpenCV Viewer Kinect RGB ", Cv_ptr_rgb-> image); // cv :: imshow ("OpenCV viewer Kinect Depth", image8U); CvWaitKey (3); } Int main (int argc, char ** argv) {Ross :: init (argc, argv, "listenerKinectuEye"); Ros :: Nodhandsley NH; Image_transport :: Image Transportation (NH); Image_transport :: Subscriber subkirgb = it.subscribe ("/ camera / rgb / image_color", 1, imageCallbackrgb); Image_transport :: Subscriber subkidepth = it.subscribe ("/ camera / depth_registered / image_raw", 1, image callback); ROS_INFO ("Subscribes to Kinect and UEye topics"); Ross :: spin (); }
And this error is that I get (sub_node is my executable):
sub_node: / usr / include / boost / smart_ptr / shared_ptr . HPP: 418: T * Boost :: Shared APTR & lt; T & gt; :: operator- & gt; () CONST [T = cv_bridge :: CvImage] with: Assertion `px! = 0 'failed revoked (core thrown)
Error indicator cv_ptr_rgb that I use in imageCallbackdepth, even when I try
< Code> cv :: imshow ("OpenCV Viewer Connect RGB", CV_PTR_RGB-> Image);
Comments
Post a Comment