Class pixel_format_base
Defined in File pixel_format_base.hpp
Inheritance Relationships
Derived Types
public usb_cam::formats::M4202RGB(Class M4202RGB)public usb_cam::formats::MJPEG2RGB(Class MJPEG2RGB)public usb_cam::formats::MONO16(Class MONO16)public usb_cam::formats::MONO8(Class MONO8)public usb_cam::formats::RAW_MJPEG(Class RAW_MJPEG)public usb_cam::formats::RGB8(Class RGB8)public usb_cam::formats::UYVY(Class UYVY)public usb_cam::formats::UYVY2RGB(Class UYVY2RGB)public usb_cam::formats::Y102MONO8(Class Y102MONO8)public usb_cam::formats::YUYV(Class YUYV)public usb_cam::formats::YUYV2RGB(Class YUYV2RGB)public usb_cam::formats::default_pixel_format(Class default_pixel_format)
Class Documentation
-
class pixel_format_base
Base pixel format class. Provide all necessary information for converting between V4L2 and ROS formats. Meant to be overridden if conversion function is required.
Subclassed by usb_cam::formats::M4202RGB, usb_cam::formats::MJPEG2RGB, usb_cam::formats::MONO16, usb_cam::formats::MONO8, usb_cam::formats::RAW_MJPEG, usb_cam::formats::RGB8, usb_cam::formats::UYVY, usb_cam::formats::UYVY2RGB, usb_cam::formats::Y102MONO8, usb_cam::formats::YUYV, usb_cam::formats::YUYV2RGB, usb_cam::formats::default_pixel_format
Public Functions
-
inline pixel_format_base(std::string name, uint32_t v4l2, std::string ros, uint8_t channels, uint8_t bit_depth, bool requires_conversion)
-
inline virtual ~pixel_format_base()
-
inline std::string name()
Name of pixel format. Used in the parameters file to select this format.
- Returns:
-
inline uint32_t v4l2()
Integer value of V4L2 capture pixel format.
- Returns:
uint32_t V4L2 capture pixel format
-
inline std::string v4l2_str()
String value of V4L2 capture pixel format.
- Returns:
std::string V4L2 capture pixel format
-
inline std::string ros()
Name of output pixel (encoding) format to ROS.
- Returns:
-
inline uint8_t channels()
Number of channels (e.g. bytes) per pixel.
- Returns:
-
inline uint8_t bit_depth()
Number for bit depth of image.
- Returns:
-
inline uint8_t byte_depth()
Number of bytes per channel.
-
inline bool requires_conversion()
True if the current pixel format requires a call to the
convertmethod Used in the usb_cam library logic to determine if a plainmemcopycall can be used instead of a call to theconvertmethod of this class.- Returns:
-
inline virtual void convert(const char *&src, char *&dest, const int &bytes_used)
Conversion method. Meant to be overridden if pixel format requires it.
-
inline bool is_color()
Returns if the final output format is color Copied from: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/include/sensor_msgs/image_encodings.hpp.
- Returns:
-
inline bool is_mono()
Returns if the final output format is monocolor (gray) Copied from: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/include/sensor_msgs/image_encodings.hpp.
- Returns:
-
inline bool is_bayer()
Returns if the final output format is bayer Copied from: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/include/sensor_msgs/image_encodings.hpp.
- Returns:
-
inline bool has_alpha()
Returns if the final output format has an alpha value Copied from: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/include/sensor_msgs/image_encodings.hpp.
- Returns:
Protected Attributes
-
std::string m_name
Unique name for this pixel format.
-
uint32_t m_v4l2
Integer correspoding to a specific V4L2_PIX_FMT_* constant See
linux/videodev2.hfor a list of all possible values for here.
-
std::string m_ros
This should match ROS encoding string See
sensor_msgs/image_encodings.hppfor corresponding possible values. Copy of those values are stored inusb_cam/constants.hpp
-
uint8_t m_channels
Number of channels (aka bytes per pixel) of output (ROS format above)
-
uint8_t m_bit_depth
Bitdepth of output (ROS format above)
-
bool m_requires_conversion
boolean whether or not the current format requires a call to
convert. Setting this to true requires that the virtualconvertmethod is implemented.
-
inline pixel_format_base(std::string name, uint32_t v4l2, std::string ros, uint8_t channels, uint8_t bit_depth, bool requires_conversion)