简体   繁体   中英

how to open the yosemite sequence with opencv in python

I have been playing around with optical flow algorithms in python, and would like to apply them on the famous Yosemite sequence (a sequence of 15 frames). Some instructions are provided, but solely in C. I would like to be able to open these frames as images in opencv so I can export them to a video file and apply optical flow algorithms. Any ideas?

Instructions in C here . Image sequences here by clicking on the Yosemite image.

if you have problems understanding the C code they provided, just say so.

as you can probably tell, the pictures have a resolution of 316 x 252.

further, they're grayscale.

the files just so happen to be 316 * 252 = 79632 bytes in size.

I would suggest reading the files and interpreting them as np.uint8 element type of the given shape.

numpy has frombuffer . read read everything from a file, use frombuffer to convert it into a numpy array.

from that, you can apply the scale and pedestal (meaning an a*x+b calculation), or just look at the values as they are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM