-
Notifications
You must be signed in to change notification settings - Fork 192
/
Copy pathadjust_camera.cpp
41 lines (33 loc) · 1.03 KB
/
adjust_camera.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <opencv2/opencv.hpp>
#include <iostream>
int main() {
// Create a VideoCapture object
cv::VideoCapture capture(0); // Adjust the camera index if needed
if (!capture.isOpened()) {
std::cout << "Failed to open video capture." << std::endl;
return -1;
}
// Create a Mat object to store the frame
cv::Mat frame;
// Main loop for video capture
while (true) {
// Read a frame from the video capture
if (capture.read(frame)) {
// Print the shape of the frame (height, width, channels)
std::cout << "Shape: " << frame.size() << std::endl;
// Display the frame
cv::imshow("Frame", frame);
} else {
std::cout << "Failed to read frame" << std::endl;
break;
}
// Exit the loop if 'q' is pressed
if (cv::waitKey(1) == 'q') {
break;
}
}
// Release the video capture and close the window
capture.release();
cv::destroyAllWindows();
return 0;
}