This source code was used from video load & display.
...
int main() { VideoCapture capture("rhinos.avi"); Mat frame; //Set properties int askFileTypeBox = 0; //-1 is show box of codec int Color = 1; Size S = Size((int)capture.get(CV_CAP_PROP_FRAME_WIDTH), (int)capture.get(CV_CAP_PROP_FRAME_HEIGHT)); //make output video file VideoWriter outVideo; //save video file by origin paramers outVideo.open(".\\outVideo.avi", askFileTypeBox, capture.get(CV_CAP_PROP_FPS), S, Color); double fps = capture.get(CV_CAP_PROP_FPS); //check if (!capture.isOpened()) { printf("AVI file can not open.\n"); return 0; } //create window namedWindow("w"); while (1) { //grab frame from file & throw to Mat capture >> frame; if (frame.empty()) //Is video end? break; //processing example //Sobel(frame, frame, frame.depth(), 1, 0); //////////////////// //outVideo.write(frame); outVideo << frame; //display and delay imshow("w", frame); //delay by origin fps if (waitKey((1 / fps) * 1000) > 0) break; } return 0; }...
μ’μ κ°μ μ λ£κ³ μμ΅λλ€.
ReplyDeleteκ·Έλ°λ° 4.0.1 λ²μ μμλ CV_CAP_PROP_FRAME_WIDTH λ±μ΄ μ λ¨Ήλ€μ. CAP_PROP_FRAME_WIDTHλ‘ μ°λ©΄ λμνλ κ² κ°μ΅λλ€.
κ·Έλ¦¬κ³ νλ μ§λ¬Έ μμ΅λλ€. μ΄μνκ² λ ΈνΈλΆμ λ¬λ¦° μΉ΄λ©λΌλ₯Ό μ¬μ©ν λ capture.get(CAP_PROP_FPS)λ‘ μ½μ΄ 보면 νμ 0 μ λλ€. μ κ·Έλ°κ±ΈκΉμ? μΌλ¨ 0μΈμ§ κ²μ¬ν΄μ 0μΌ κ²½μ° μμλ‘ 30μ λλ‘ ν λΉμ νκ³ μμ΅λλ€λ§ μ κ·Έλ°μ§ κΆκΈν΄μμ.
κ³μ μ’μ κ°μ λΆν λ립λλ€.