Open image from file with image_publisher
Hi everybody, I try to publish an an Image (bmp.file) to an camera stream with image_publisher. I want to display this Image with image_view. But here I got an error.
Can somebody tell me how to fix the error?
It would be nice to get a hint.
Greetings
P.S. I'm using kinetic with ubuntu 16.04.
Edit: I want use image_publisher for that issue. But I can't get it run. The Error occurs immediately when I launched the file. Please help me. Solved: edited image path with ($find package)
My launchfile (copied from here http://wiki.ros.org/image_publisher) I just edited the image-path:
<launch>
<node pkg="image_publisher" type="image_publisher" name="mix_image" args="~/mix.bmp" >
<param name="flip_horizontal" value="false" />
<param name="flip_vertical" value="false" />
<param name="frame_id" value="my_camera" />
<param name="publish_rate" value="10" />
<param name="camera_info_url" value="file:///$(env HOME)/.ros/camera_info/camera.yaml" /> <!-- relative to ~/.ros/ -->
</node>
</launch>
When I launch that file (from the same directiory where the mix.bmp is saved), I get this output:
nils-ros@nils-ros:~$ roslaunch ar_with_ros mix_image_publisher.launch
... logging to /home/nils-ros/.ros/log/efc677ac-8eaf-11ea-a878-1867b0105cea/roslaunch-nils-ros-17494.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://nils-ros:35825/
SUMMARY
========
PARAMETERS
* /mix_image/camera_info_url: file:////home/nil...
* /mix_image/flip_horizontal: False
* /mix_image/flip_vertical: False
* /mix_image/frame_id: my_camera
* /mix_image/publish_rate: 10
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
/
mix_image (image_publisher/image_publisher)
ROS_MASTER_URI=http://localhost:11311
process[mix_image-1]: started with pid [17511]
OpenCV Error: Assertion failed (cap_.isOpened()) in onInit, file /home/nils-ros/ws_moveit/src/image_pipeline/image_publisher/src/nodelet/image_publisher_nodelet.cpp, line 147
[ERROR] [1588670851.783852606]: Failed to load image (~/mix.bmp): cap_.isOpened() onInit /home/nils-ros/ws_moveit/src/image_pipeline/image_publisher/src/nodelet/image_publisher_nodelet.cpp 147
The bmp-file is 480x640Pixel big and colored. It is 922 kB big.
I'm using image_publisher as well as image_view from source because I can't call them without. My test: roscd image_publisher/ called ~/ws_moveit/src/image_pipeline/image_publisher For some unknown reason roscd didn't recognized the preinstalled version. That's why I used it from source.
Edit2: I deleted image_pipeline from my workspace. Wrote roscd image_ <tab> <tab> on the terminal an only got this output. Solved: see Edit above
image_common/ image_transport/
image_geometry/ image_transport_plugins/
After I wrote roscd image_publisher it found the path /opt/ros/kinetic/share/image_publisher . When I now write roscd image_ <tab> <tab> on the terminal it shows me the other image_common/ image_publisher/ image_transport_plugins/ image_geometry/ image_rotate/ image_view/ image_proc/ image_transport/
I still get the same errormessage linking to /home/nils-ros/ws_moveit/src/image_pipeline/image_publisher/src/nodelet/image_publisher_nodelet.cpp 147 also I deleted the image_pipline package and run catkin_make
Edit3: I changed the path to $(find ar_with_ros)/image/mix.bmp and I don't get an error anymore. Thank you for that one. But when I want to see the image with image_view I get only this ...