Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7290

C/C++ • Getting pixel data when using Libcamera to pass into OpenCV

$
0
0
Hey y'all,

TL;DR : I'm going through the rpicam_hello example and trying to figure out exactly where the pixel data is being stored so I can 'pass' that data into a cv::Mat() object so I can take advantage of what OpenCV has to offer image processing-wise.

Does anyone out there know or can point me in the right direction?

I've skimmed through the `rpicam-hello` example and assumed in the `event_loop()` function that the following three lines of code are mainly for setting up the camera parameters

Code:

   app.OpenCamera();   app.ConfigureViewfinder();   app.StartCamera();
But in `app.ShowPreview(completed_request, app.ViewfinderStream());` copies a shared_ptr and I'm heavily assuming that's where I need to insert the needed OpenCV functions.

Code:

void RPiCamApp::ShowPreview(CompletedRequestPtr &completed_request, Stream *stream){std::lock_guard<std::mutex> lock(preview_item_mutex_);if (!preview_item_.stream)preview_item_ = PreviewItem(completed_request, stream); // copy the shared_ptr here <------ THIS IS WHAT I'M TALKIN BOUTelsepreview_frames_dropped_++;preview_cond_var_.notify_one();}

Statistics: Posted by Digital1O1 — Thu Jul 18, 2024 12:14 am — Replies 0 — Views 35



Viewing all articles
Browse latest Browse all 7290

Trending Articles