improve resolution

This commit is contained in:
Thomas BONNIER 2024-11-29 16:46:08 +01:00
parent 0f2cfce8f8
commit b9313d40c0
1 changed files with 8 additions and 1 deletions

View File

@ -64,13 +64,20 @@ void processFrame(const cv::Mat& frame)
void frameProcessingThread()
{
cv::VideoCapture cap(0); // Open the default camera
cv::VideoCapture cap(0, cv::CAP_V4L2); // Open the default camera with V4L2 backend
if (!cap.isOpened())
{
ROS_ERROR("Unable to open camera");
return;
}
// Set the desired resolution
cap.set(cv::CAP_PROP_FRAME_WIDTH, 1920); // Set width to 1920 pixels
cap.set(cv::CAP_PROP_FRAME_HEIGHT, 1080); // Set height to 1080 pixels
// Set the desired frame rate
cap.set(cv::CAP_PROP_FPS, 15); // Set frame rate to 15 Hz
while (ros::ok())
{
cv::Mat frame;