camera format

The formats of pictures can generally be divided into yuv format and RGB format, as well as png and jpg formats;

The format of the camera corresponding to the yuv format can be YUYV, UYVV, YVYU, VYUY;

The camera formats corresponding to images in rgb format are RGB, BGR, and ARGB8888 formats;

1. What problems will occur if the RGB8888 and ARGB8888 pixel formats are confused?

Because ARGB8888 has one more channel A, where A stands for α, which is the channel of transparency, so it corresponds to RGB32; the pixel format corresponding to RGB8888 is RGB24, but this point is ignored in the process of writing code, resulting in the color gamut space of the picture Changes occur, as shown below: simply speaking, yellow is recognized as blue, and blue is recognized as red;

Pictures with confusing color gamut space

 But when the ARGB888 format is mapped to the RGB32 pixel format, or RGB8888 is mapped to the RGB24 pixel format, the color of the picture returns to normal;

Pictures with normal color gamut space

2. If you want to increase the viewing angle using fisheye panoramic splicing:

You can adjust the height of the AVM viewing angle by changing the two values ​​​​of pz and zoom;

3. What should I do if the dump image is rgb or yuv and cannot be opened?

If it is a picture in rgb format, you can use the following python code to convert the picture in rgb format to a picture in png format to view the effect of fisheye stitching;

import cv2
import numpy as np

def rgb2jpg(name,shape):
    with open(name,'rb') as f:
        data = np.fromfile(f, dtype=np.uint8)
    data = np.reshape(data,shape)
    data =cv2.cvtColor(data,cv2.COLOR_RGB2BGR)
    cv2.imwrite(name[:-4]+'.jpg',data)
    # cv2.imshow("data",data)
    cv2.waitKey(0)

if __name__ == "__main__":
    rgb2jpg("rgb格式图片的名字.rgb",(宽*高*3)) #如果是rgb格式的图片就是*3,如果是argb就是*4

If the picture is in yuv format, you can use a tool called yuvplayer to open it. Remember to adjust the width, height and pixel format of the picture; GitHub - leixiaohua1020/YUVplayer: Modified from a sourceforge project

Guess you like

Origin blog.csdn.net/m0_48707860/article/details/131002872