c++ - Older version Commands of opencv are not working in newer versions -
i using opencv 3.0.0 beta, , fails recognize cv::fourcc
, cv_cap_prop_frame_width
, cv_cap_prop_frame_height
older versions. how go using them in newest version. here's sample code providing example of might need them, , unable use them in opencv 3.0.0 beta.
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/videoio/videoio.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/video/video.hpp> #include <opencv2/imgcodecs/imgcodecs.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/core.hpp> #include <iostream> #include <sstream> using namespace cv; using namespace std; int main() { videocapture cap("h:\\images\\v1.mp4"); cv::videowriter writer; string filename = "h:\output_video.avi"; int fcc = cv::fourcc('d', 'i', 'v', '3'); // error shown line int fps = 20; cv::size framesize(cap.get(cv_cap_prop_frame_width), cap.get(cv_cap_prop_frame_height)); // error shown line writer = videowriter(filename, fcc, fps, framesize); for(;;) { mat frame; cap >> frame; writer.write(frame); namedwindow("output video"); imshow("output video", frame); char key = (char)waitkey(50); if(key == 'q' || key == 'q' || key == 27) { break; } } return 0; }
Comments
Post a Comment