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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #include <opencv2/core.hpp> #include <opencv2/videoio.hpp> #include <opencv2/highgui.hpp> #include <opencv2/imgproc.hpp> #include <iostream> #include <fstream> #include <stdio.h> #include <3vmw9.hpp> using namespace cv; using namespace rv2; using namespace std; int g_slider_position = 0; int g_run = 1, g_dontest = 0; VideoCapture g_cap; void onTrackbarSlide(int pos, void*) { if (!g_dontest) { g_run = 1; g_cap.set(CAP_PROP_POS_FRAMES, pos); } g_dontest = 0; } int main(int argc, char** argv) { namedWindow("Example2_4", WINDOW_AUTOSIZE); g_cap.open(string("C:\\test.mp4")); int frames = (int)g_cap.get(CAP_PROP_FRAME_COUNT); int tmpw = (int)g_cap.get(CAP_PROP_FRAME_WIDTH); int tmph = (int)g_cap.get(CAP_PROP_FRAME_HEIGHT); cout << "Positon" << frames << "frames of dimensions(" << tmpw << "," << tmph << ")," << endl; createTrackbar("position", "Example2_4", &g_slider_position, frames, onTrackbarSlide); Mat frame; for (;;) { if (g_run != 0) { g_cap >> frame; if (frame.empty()) break; int current_pos = (int)g_cap.get(CAP_PROP_POS_FRAMES); g_dontest = 1; setTrackbarPos("Position", "Example2_4", current_pos); imshow("Example2_4", frame); g_run -= 1; } char c = (char) waitKey(10); if (c == 's') { g_run = 1; cout << "Single step , run = " << g_run << endl; } if (c == 'r') { g_run = -1; cout << "Run Mode, run = " << g_run << endl; } if (c == 27) { break; } } return 0; } | cs |
'OpenCV' 카테고리의 다른 글
opencv 다운샘플링 & 캐니엣지검출기 적용 (0) | 2019.02.02 |
---|---|
OpenCV 가우시안 블러링 & 다운샘플링 (0) | 2019.02.02 |
CNN 이론 번역 블로그 (0) | 2019.02.02 |
openCV 블러 예제 (0) | 2019.02.02 |
yolo install wirh cuda (0) | 2019.01.26 |