I have been checking and comparing frame pixels of that obtained with python cv2.imread() method and C++ cv2.imread() method. C++ and python imread() method obtained same frame pixels. But when I try to use videocapture cap.read(), C++ and python got different frame pixels for same frame. My c++ and python videoCapture objects have default object arguments. I did not use any codec in videocaptures.
I do not know why I got this result. But I checked my python and c++ code many time. Already sc++ and python code very simply.
Please can you post a code snippet for the python and c++ and version of opencv you are using.
Please can you try another video to rule out that it is not the video itself but the code.
Admitted this is very odd and very unlikely to be opencv lib
hi,
I share code and ouputs.
My cmake version 3.5.1, my gcc version 5.4.0
My c++ code run on jetson tx2 ubuntu 16.04.
My Python code run on Windows 10 (python version 3.7)
import cv2
def frame_read():
cap = cv2.VideoCapture("./test4.avi")
i = 0
while (cap.isOpened()):
i = i + 1
ret, img = cap.read()
if img is not None:
row, column, _ = img.shape
for k in range(224):
print(k, end=' ')
for l in range(224):
print(str(img[k,l]) + "(" + str(l) +") ", end=' ')
print()
break
if __name__ == '__main__':
frame_read()
Yes my results on windows and jetson are not equal.
C++ and python cap.read()'s frame have different pixel values .
I haven’t used codec arguments. I used default codec for python and c++ as in shared code