Quantcast
Viewing all articles
Browse latest Browse all 4922

Camera board • Re: Extracting Chroma Data From Luminance Mat Object

Alright..... So I finally have some good news after my buddy and I were a little bit emotionally traumatized after painfully sifting through all the Libcamera documentation and realizing the answer was in front of us after nearly two hours of troubleshooting

So what ended up causing the overexposure was two things

1) The brightness was set to 0.5
2) The Auto Exposure setting was set to FALSE by default

Code:

/* * -------------------------------------------------------------------- * Frame Capture * * libcamera frames capture model is based on the 'Request' concept. * For each frame a Request has to be queued to the Camera. * * A Request refers to (at least one) Stream for which a Buffer that * will be filled with image data shall be added to the Request. * * A Request is associated with a list of Controls, which are tunable * parameters (similar to v4l2_controls) that have to be applied to * the image. * * Once a request completes, all its buffers will contain image data * that applications can access and for each of them a list of metadata * properties that reports the capture parameters applied to the image. */Stream *stream = streamConfig.stream();const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator->buffers(stream);std::vector<std::unique_ptr<Request>> requests;for (unsigned int i = 0; i < buffers.size(); ++i){std::unique_ptr<Request> request = camera->createRequest();if (!request){std::cerr << "Can't create request" << std::endl;return EXIT_FAILURE;}const std::unique_ptr<FrameBuffer> &buffer = buffers[i];int ret = request->addBuffer(stream, buffer.get());if (ret < 0){std::cerr << "Can't set buffer for request"  << std::endl;return EXIT_FAILURE;}/* * Controls can be added to a request on a per frame basis. */ControlList &controls = request->controls();// controls.set(controls::Brightness, 0.5); // This was here orignallycontrols.set(controls::AE_ENABLE, true);requests.push_back(std::move(request));}
So after all that trauma bonding we were finally able to get a color image using Libcamera, the IMX219 and a Raspberry Pi 5
Image may be NSFW.
Clik here to view.
Screenshot 2024-08-09 163037.jpg
For what it's worth, OpenCV is being used to store/display the image data.

The link to the Github repo can be found here : https://github.com/Digital1O1/simple-cam_libcamera

Statistics: Posted by Digital1O1 — Fri Aug 09, 2024 9:36 pm



Viewing all articles
Browse latest Browse all 4922

Trending Articles