import cv2
import numpy as np
cameraCapture = cv2.VideoCapture('test_1.avi')
success, frame = cameraCapture.read()
while success:
if cv2.waitKey(1) == 27:
break
cv2.imshow('Test camera', frame)
success, frame = cameraCapture.read()
milliseconds = cameraCapture.get(cv2.CAP_PROP_POS_MSEC)
seconds = milliseconds//1000
milliseconds = milliseconds%1000
minutes = 0
hours = 0
if seconds >= 60:
minutes = seconds//60
seconds = seconds % 60
if minutes >= 60:
hours = minutes//60
minutes = minutes % 60
print(int(hours), int(minutes), int(seconds), int(milliseconds),a)
cv2.destroyAllWindows()
cameraCapture.release()
I want to print the time line of this video as well as the mean of this frame,for example like printf (0h 0m 2s 33m 34)
What I have tried:
cv.cvtColor(image, gray, cv.COLOR_RGB2GRAY);
Mat mat_mean, mat_stddev;
meanStdDev(gray, mat_mean, mat_stddev);
double a = mat_mean.at<double>(0, 0);
double d = mat_stddev.at<double>(0, 0);
I once wanted to bring the C++ program code into the program, but I couldn't implement the call to the mean function. How can I change my program