Solution-Proposal for Camera/Image-Display (Frontend)

In ROS (Robot Operating System), the sensor_msgs/Image and the sensor_msgs/CompressedImage message types are used to represent images captured from a camera or other image source.ย 

The main difference between these two message types is that sensor_msgs/Image represents uncompressed images, while the sensor_msgs/CompressedImage represents compressed images.ย 

The sensor_msgs/Image contains the raw pixel data of the image, along with metadata such as the image dimensions, encoding type, and time stamp. This message type is commonly used when high image quality is required, and the processing power and bandwidth are sufficient to handle the uncompressed image data.ย 

On the other hand, sensor_msgs/CompressedImage contains a compressed version of the image, using a compression algorithm such as JPEG or PNG. This message type is useful when bandwidth or processing power is limited, as the compressed image requires less data to transmit and process. However, the image quality may be lower than an uncompressed image.ย 

In summary, the choice of message type depends on the specific requirements of the application, such as the available bandwidth, processing power, and desired image quality.ย 

ย 

Refresh rate:ย 

If we want to stream live footage, we must choose a suitable refresh rate to avoid overloading the network and having bandwidth problems.ย 

The refresh rate (also known as the frame rate) for the live stream will depend on several factors, including the available network bandwidth, the video compression settings, and the processing power of the encoder and decoder.ย 

To avoid overloading the network and causing bandwidth problems, one should ensure that the total bitrate of the live stream doesnโ€™t exceed the available upload bandwidth of the internet connection. As a general rule of thumb, the total bitrate of the live stream shouldnโ€™t exceed 80% of your available upload bandwidth to ensure smooth and stable streaming.ย 

Assuming the upload bandwidth is 10 Mbps, the maximum total bitrate for the live stream should be around 8 Mbps.ย 

To determine your available upload bandwidth, you can perform an internet speed test using one of the many online speed testing tools available.ย 

It's important to note that your available upload bandwidth may vary depending on various factors such as network congestion, time of day, and the number of devices connected to your network.ย 

ย 

How to calculate the bitrate of raw images?ย 

The bitrate (in bits per second or bps) is the amount of data that is transmitted per second in a video or audio stream. To calculate the bitrate for a video stream, the following parameters are needed:ย 

  • Frame size - the size of each video frame in pixels (e.g., 1920x1080 for a 1080p video)ย 

  • Frame rate - the number of frames per secondย 

  • Video codec (bit depth) - the video compression algorithm used to encode the video stream.ย 

For example: to calculate the bitrate of a raw image with a resolution of 1920*1080, a frame rate of 10 fps, and a bit depth of 8 bits per pixel we use the following formula:ย 

Bitrate = Frame size x Frame rate x Bit depthย 

Bitrate = (1920*1080) * 10 * 8 = 165888000 bits per second = 20,736 Megabyte per secondย 

To achieve this transmission, we need a minimum upload bandwidth of 25 Mbps.ย 

The table below shows the bitrates of some image resolutions and refresh rates:ย 

ย (The unit of the Bitrate is Megabyte per second)

How to calculate the bitrate of compressed images?ย 

The most used method for image compression is the JPEG (Joint Photographic Experts Group) compression method. This method uses lossy compression, which means that some data is lost during the compression process, resulting in a smaller file size.ย 

To calculate the new bitrate, we must calculate the compressed image size.ย 

Calculating the size of an image after compression with the JPEG algorithm is a bit more complicated than calculating the uncompressed image size. This is because the file size of a JPEG-compressed image depends on several factors, such as the quality setting and the complexity of the image.ย 

There is an online page where it is possible to calculate the compressed image size: Image filesize calculator ยท toolstud.io .ย 

Assuming that the compression is 90% with the new Bitrate table would look like this:ย 

ย