Extracting frames using mmreader and calculate and substract mean from data
Afficher commentaires plus anciens
hello all, i am using mmreader to input video,
i want to extract all Y frames of video object and calculate their mean and finally subtract their mean from the data.
so that y frames will be mean zero.
plz help.
thanks....
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 20 Déc 2011
1 vote
By default, mmreader's read() method reads all frames and stores them in to a single 4D matrix. You can calculate the mean for each pixel across all the frames by using mean(TheArray,4) . You can then repmat() that with the factor [1,1,1,size(TheArray,4)] and subtract that from TheArray
Warning: when you do that, you will end up with negative entries if your data is double precision, but if your datatype is uint8 (as would be common) the negative entries would be clamped to 0. double(TheArray) - themean in order to get an unclamped result. But you will still need to figure out what you want to do about the negative entries and about the fact that your unclamped values will range from -255 to +255 (if the data was uint8)
Catégories
En savoir plus sur Video Formats and Interfaces dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!