Closed MasIgor closed 2 years ago
The image you gather is in the BayerRG8
colorspace, you need to convert it to BGR
first in order to use it.
I recommend using opencv, but the color conversions for bayer codecs in there are not 100% in line with all camera producers/manufacturers, you may need to play around a little bit to find the one for your camera.
https://docs.opencv.org/4.x/de/d25/imgproc_color_conversions.html
I would try it with:
retrieved_image = np.ndarray(buffer=component.data.copy(), dtype=np.uint8, shape=(component.height, component.width, 1)) retrieved_image = cv2.cvtColor(retrieved_image, cv2.COLOR_BayerBG2BGR)
The other option would be to use a different color space for your image acquisition, but that entirely depends on your camera, which I am not familliar with.
@Gornoka Thank you for your kind help! I appreciate that. Regards, Kazunari.
@Gornoka Sorry for the late reply, I have to admit that I tested it and forgot to answer. It worked like a charm. Thank you!!
Hello all!
First off thank you for this!
I'm trying to read a genie nano color c1920, and to use the image with yoloV5.
The script loads a jpg file (first rows) and I am trying to replace that code with the frame taken from the camera. Problem is that it only reads one channel and the size of the array is wrong. the array that cv2.imread(path) generates is 3 dimensional: {640,640,3} with a total size of 1228800. the array that the GigE code generates is 1 dimensional {409600} so just one third of the expected size. Also if I use Harvester GUI, the image is black and white. Why? What am I doing wrong?
Thanks, any help appreciated.