I have a Raspberry PI 3 b+ and a TheImagingSource DYK 33GX250 camera. However, when I open the aravis viewer, I can’t change the pixel format “PolarizedBayerGB8” and I can’t stream. How can I change the pixel format? Thanks in advance.
Hi,
Aravis viewer relies on GStreamer for the conversion from the device pixel format to the display pixel format. I don’t think there is a GStreamer converter for polarized bayer.
Emmanuel.
After that, I tried to change the pixel format by using a Python code. This is my code:
import cv2
import time
import logging
import numpy as np
import ctypes
import gi
import sys
gi.require_version(‘Aravis’, ‘0.8’)
from gi.repository import Aravis,GLib
if name == “main”:
if len(sys.argv) > 1:
arg= sys.argv[1]
else:
path = “frame.png”
cam = Camera(None)
cam.set_feature(“Width”, 2448)
cam.set_feature(“Height”, 2000)
cam.set_frame_rate(10)
cam.set_exposure_time(2000000)
cam.set_pixel_format(Aravis.PIXEL_FORMAT_BAYER_BG_8)
cam.start_acquisition_continuous()
try:
frame = cam.pop_frame()
print("Saving image to ", path)
frame=cv2.imread(“frame.png”)
cv2.imwrite(path, frame)
finally:
cam.stop_acquisition()
cam.shutdown()
But unfortunately, I got a error:
cam.set_pixel_format(Aravis.PIXEL_FORMAT_BAYER_BG_8)
gi.repository.GLib.GError: arv-gc-error-quark: [PixelFormat] Value 17301515 not found (4)
I can’t figure out what is the problem.
If I have read correctly the camera documentation, it only supports polarized pixel formats. You should be able to verify this point using arv-tool-0.8 features PixelFormat
.
Thanks for your quick response. It turns out that the camera supports only the formats ‘PolarizedBayerBG16’, ‘PolarizedBayerBG12Packed’ and ‘PolarizedBayerBG8’. So, I changed the line cam.set_pixel_format(Aravis.PIXEL_FORMAT_BAYER_BG_8) to cam.set_pixel_format_from_string(‘PolarizedBayerBG8’). Code works but the image is grayscale. Do you have any idea why I get grayscale image instead of a coloured one?
I also tried the line cam.set_feature(‘PixelFormat’,‘PolarizedBayerBG8’) but it did not work either.
Aravis does not convert pixel formats. It is the job of the library you are using to display or save the camera raw data, being either cv2 or gstreamer.
“Polarized” images produced by your camera are very specific, so I guess you have to code a conversion that fits your need.