-
Notifications
You must be signed in to change notification settings - Fork 9
/
ReadWriteLogPolarFromCamera.cpp
57 lines (43 loc) · 1.24 KB
/
ReadWriteLogPolarFromCamera.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
int main(int args, char* op[]) {
cv::namedWindow("Camera Check", cv::WINDOW_AUTOSIZE);
cv::namedWindow("Output", cv::WINDOW_AUTOSIZE);
cv::VideoCapture cap;
cap.open(0);
if (!cap.isOpened()) {
std::cerr << "Coudln't open camera" << std::endl;
return -1;
}
cv::Size size(
(int)cap.get(cv::CAP_PROP_FRAME_WIDTH),
(int)cap.get(cv::CAP_PROP_FRAME_HEIGHT)
);
cv::VideoWriter writer;
writer.open(op[1], CV_FOURCC('M', 'J', 'P', 'G'), 120, size);
cv::Mat frame, logpolar_frame;
while (true) {
cap >> frame;
if(frame.empty()) {
break;
}
cv::imshow("Camera Input", frame);
cv::logPolar(
frame,
logpolar_frame,
cv::Point2f(
frame.cols/2,
frame.rows/2
),
40,
cv::WARP_FILL_OUTLIERS
);
cv::imshow("Output", logpolar_frame);
writer << logpolar_frame;
if (cv::waitKey(33) >= 0) {
break;
}
}
return 0;
}