Comments (12)
[WARN] [1671735223.499671649] [camera]: no pixel format selected, using default:
"BGR888"
is in the camera_node log file.
it gets this from my default set in config.txt
Autoload overlays for any recognized cameras or displays that are attached
to the CSI/DSI ports. Please note this is for libcamera support, not for
the legacy camera stack
camera_auto_detect=0
display_auto_detect=1
dtoverlay=vc4-kms-v3d,cma-512
dtoverlay=imx219
dtoverlay=imx219,cam0
Config settings specific to arm64
arm_64bit=1
from camera_ros.
There is no configuration file in this repo. By default, the node will select the first available pixel format. You can change that.
What is the encoding
of the published mage? What happens when you change the format? How can I reproduce this?
from camera_ros.
I can reproduce this issue with the vivid
driver on my desktop. After loading the kernel module via sudo modprobe vivid
the new V4L2 device will show a test pattern with coloured vertical bars (note the red, blue, black bar order). You can check this also with VLC which lets you open a capture device:
To use this with libcamera
, you have to use the vivid
branch from the vivid
fork https://git.libcamera.org/libcamera/vivid.git. When everything is set up correctly, you can use the device with the BGRA8888
format:
qcam -c vivid --stream pixelformat=BGRA8888
and it will show the test pattern correctly (red, blue, black):
When I then use this device with the ROS node and the BGR888
format:
ros2 run camera_ros camera_node --ros-args -p camera:=vivid -p format:=BGR888
the image will be published with the correct bgr8
encoding
:
$ ros2 topic echo --once /camera/image_raw --field encoding
bgr8
---
but rqt
will show the test pattern with switched red and blue colour bars:
from camera_ros.
from camera_ros.
This problem is not specific to the Raspberry Pi camera as I showed above with the vivid
test driver.
When you mention the "config yaml file" do you mean the "Camera calibration file"? If you did not calibrate your camera yet, then this warning is normal. I just says that the camera calibration file cannot be found at the expected location because the camera was never calibrated.
from camera_ros.
from camera_ros.
Thanks for your reply. Is there a parameter to pass to camera_ros to flip the channels?
No, and there should be no such parameter because the colour format mapping between libcamera and the ROS image encodings should work correctly. I am going to look into this. In the meantime, you can simply change the encoding from bgr8
to rgb8
in order to have the channels switched.
from camera_ros.
from camera_ros.
I wrote a simple python script to visualise the channels of an image:
#!/usr/bin/env python3
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import Image
import numpy as np
import cv2
class FormatVisualiser(Node):
def __init__(self):
super().__init__('format_visualiser')
self.sub_img = self.create_subscription(Image, "/camera/image_raw", self.on_image, 1)
def on_image(self, msg_img):
dtype = np.dtype(msg_img.data.typecode)
dtype = dtype.newbyteorder('>' if msg_img.is_bigendian else '<')
img_raw = np.asarray(msg_img.data.tolist(), dtype=dtype)\
.reshape(msg_img.height, msg_img.width, int(msg_img.step/msg_img.width))
for i in range(img_raw.shape[2]):
cv2.imshow(f"raw channel {i}", img_raw[...,i])
if msg_img.encoding == "bgra8":
img_rgb = cv2.cvtColor(img_raw, cv2.COLOR_BGRA2RGB)
cv2.imshow("rgb", img_rgb)
for i in range(img_rgb.shape[2]):
cv2.imshow(f"rgb channel {i}", img_rgb[...,i])
img_bgr = cv2.cvtColor(img_raw, cv2.COLOR_BGRA2BGR)
cv2.imshow("bgr", img_bgr)
for i in range(img_bgr.shape[2]):
cv2.imshow(f"bgr channel {i}", img_bgr[...,i])
cv2.waitKey(1)
if __name__ == "__main__":
rclpy.init()
exporter_node = FormatVisualiser()
rclpy.spin(exporter_node)
exporter_node.destroy_node()
rclpy.shutdown()
When I use this with the BGRA8888
format (or BA24
in fourcc):
ros2 run camera_ros camera_node --ros-args -p camera:=vivid -p format:=BGRA8888
I can clearly see that the channels in memory are A
, R
, G
, B
, i.e. in inverse order (the alpha channel is supposed to be empty). This inverse order comes from the endianness (see https://en.wikipedia.org/wiki/RGBA_color_model#Representation).
Since the ROS message contains the endianness, I thought that the client is supposed to deal with the memory representation.
from camera_ros.
I (force) pushed an update to slect the target ROS encoding via the machine endianness. This should resolve your issue. Can you check?
from camera_ros.
Thank you, it works! Issue is resolved.
from camera_ros.
Nice. Then I will go ahead and close this issue.
from camera_ros.
Related Issues (20)
- error specifying default camera HOT 5
- No cameras available on Ubuntu 22.04 with ROS humble HOT 4
- Libcamera on Ubuntu 22 HOT 1
- FPS and resolution HOT 1
- Support for Image Transport (Idea) HOT 9
- Error "what(): cannot create std::vector larger than max_size() [ros2run]: Aborted" when run camera_node HOT 4
- Is there an example launch file? HOT 18
- Build errors when remote building ROS packages HOT 2
- Image encoding issue HOT 2
- Invalid configuration HOT 18
- Camera feeds send data for half a second then become unstable. HOT 2
- How can I disable auto exposure and set exposure time? HOT 10
- Segmentation faults with IMX219 HOT 11
- Raspberry Pi 5 with IMX477 HOT 1
- Build issue when running colcon
- IMX477 sensor configured as a sink HOT 1
- Is there a ROS1 version? HOT 2
- No Calibration File for OV5647 HOT 10
- Upper limit of ExposureTime is 0 HOT 2
- default configuration differs from libcamera examples
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camera_ros.