3 questions: (1) streaming YUV420 (2) turning off red and blue (3) adaptive callback #564
-
I'm working on code to analyse data from a scientific instrument, using an HQ camera on a RP 4B with a 64-bit OS. My code does the following:
My callback (a) analyses data in the main array, then (b) modifies that array, annotating it with some text and lines. I can't use RGB. Only with YUV420 is the analysis fast enough to complete in ~40 ms. I have three questions: (1) I'd like to stream my modified frames so they can be viewed on a browser. The code in examples/mjpeg_server.py works well when main is formatted RBG, but fails on YUV420. Is there a way to stream YUV420? (The JpegEncoder() source code indicates that it can accept YUV420 input. Perhaps I have not figured out how to invoke it correctly?) (2) My instrument uses only green light. Is there a simple way for me to "turn off" red and blue in the camera? For example setting black_level_b = black_level_r = 65535? Or setting the color correction matrix to CCM = diag(0,1,0)? I'd like the camera to set exposure/gains based entirely on the green pixels, and to leave the blue and red out of the luminance (Y) computation when creating the YUV420 data. (I've looked through the Raspberry Pi Camera Algorithm and Tuning Guide. Can I experiment with the settings by creating my own .json files? Is there a python call that can be used to make the image processing pipeline read this?) [EDIT: reading the source code picamera2/picamera2.py I see Picamera2.load_tuning_file().] (3) I am timing my callback code. I noticed that on startup, it appears that the callback is not invoked for every frame. Then, the call rate increases so that after a few seconds the handler is invoked for every frame. Is the callback initially invoked only on every n'th frame and timed, then gets invoked more frequently, once the caller is confident about the time to return? (Note: I get the mean callback rate by counting the total number of callbacks, then dividing by the elapsed wallclock time since the first callback.) Thanks very much for assistance with any of these three issues! Bruce |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi, thanks for the questions. Let me try to answer.
which should have the same effect. Those gains should be used in the AGC/AEC for calculating Y values, so I believe it will do what you want.
|
Beta Was this translation helpful? Give feedback.
-
I wanted to follow through on item (2), which was to turn off the blue and red response. You were correct: the following worked perfectly!
I have a new question, but will ask this in a new thread! |
Beta Was this translation helpful? Give feedback.
Hi, thanks for the questions. Let me try to answer.
I think you've posted this as a bug, and I've replied over on that thread. You may want to use the MJPEGEncoder instead.
You can set the colour gains, though unfortunately setting them to exactly zero is interpreted as meaning "turn the AWB on". But this should work
which should have the same effect. Those gains should be used in the AGC/AEC for calculating Y values, so I believe it will do what you want.