MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / displayClip

Function displayClip

examples/Example_opencv.cpp:45–72  ·  view source on GitHub ↗

Show the pre-processed clip on the screen

Source from the content-addressed store, hash-verified

43
44// Show the pre-processed clip on the screen
45void displayClip(openshot::Clip &r9){
46
47 // Opencv display window
48 cv::namedWindow("Display Image", cv::WINDOW_NORMAL );
49
50 // Get video lenght
51 int videoLenght = r9.Reader()->info.video_length;
52
53 // Loop through the clip and show it with the effects, if any
54 for (long int frame = 0; frame < videoLenght; frame++)
55 {
56 int frame_number = frame;
57 // Get the frame
58 std::shared_ptr<openshot::Frame> f = r9.GetFrame(frame_number);
59 // Grab OpenCV::Mat image
60 cv::Mat cvimage = f->GetImageCV();
61
62 // Display the frame
63 cv::imshow("Display Image", cvimage);
64
65 // Press ESC on keyboard to exit
66 char c=(char)cv::waitKey(25);
67 if(c==27)
68 break;
69 }
70 // Destroy all remaining windows
71 cv::destroyAllWindows();
72}
73
74int main(int argc, char* argv[]) {
75

Callers 1

mainFunction · 0.85

Calls 3

GetImageCVMethod · 0.80
ReaderMethod · 0.45
GetFrameMethod · 0.45

Tested by

no test coverage detected