Extracting frames using mmreader and calculate and substract mean from data
显示 更早的评论
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....
采纳的回答
更多回答(1 个)
Walter Roberson
2011-12-20
1 个投票
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)
类别
在 帮助中心 和 File Exchange 中查找有关 Video Formats and Interfaces 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!