VideoReader - cropped frame
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
moose
il 6 Ott 2015
Commentato: Walter Roberson
il 8 Giu 2020
Hello,
I'm using VideoReader to import *.avi file to Matlab.
My original file is quite large, it's 480x480 pixels, 24 bits per pixel.
If I'm trying to read all the frames using getFrame as in the code below, it takes a lot of time.
k = 1;
while hasFrame(xyloObj)
mov(k).cdata = readFrame(xyloObj);
k = k+1;
end
So I get a struct, mov, with frames size of 480x480x3.
My questions are: A) how can read only 8 bits per pixel, so my struct would be only "one layer"... 480x480x1? B) how can I read only a cropped region every frame? I mean can I read 64x64 ROI every loop, instead of read the full frame every time?
Thank You!
0 Commenti
Risposta accettata
Walter Roberson
il 6 Ott 2015
If your image is RGB24 then VideoReader always reads and outputs the entire data. If your image was indexed then you could specify 'native' to get back a struct that had the indexing information and the colormap and so would be slightly faster.
VideoReader always returns the entire frame; there is no crop option (at least up to R2015b).
The methods of setting cropping and format to return data only work for live video, not reading from a file.
3 Commenti
Michal Semonsky
il 8 Giu 2020
Hello, is this information still up too date or is there any crop function within video reader? Thank you
Walter Roberson
il 8 Giu 2020
The information is still up to date: there is no crop function within VideoReader, or vision.VideoFileReader
What is different since that time is that there is now an imcrop3 that can be (carefully) applied to a Rows x Columns x Panes x Images 4D array to reduce the numeber of rows and columns on every image, which could be useful in cropping if you used the read() method to read multiple frames.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!