Averaging tiff frames and writing - movie is all white?
1 view (last 30 days)
Show older comments
So, I am loading in a tiff movie, selecting frames of interest and averaging them together, so that I can watch an average movie of a mouse behaving within certain time windows. I am using imwrite to save my movie (after converting each frame to double, not sure bout this though), and the final averaged tiff movie that gets saved just has all white frames. I'm sure there is a simply error I'm making to do with the way I'm formatting variables?
for stimType = 1:size(Ind_Master,3) sum_tiffs = zeros(size(AllFrames,1),size(AllFrames,2)); tiff_count = 0; mean_mov = []; for PS_frame = 1:framesPerEpoch*numEpochs for repNum = 1:size(Ind_Master,1) ref_frame = Ind_Master(repNum,1,stimType); if ref_frame < 0 break end cur_frame = ref_frame + PS_frame-1; sum_tiffs = sum_tiffs + double(AllFrames(:,:,cur_frame)); tiff_count = tiff_count + 1; end PS_frame_avg = sum_tiffs ./ tiff_count; mean_mov = cat(3,mean_mov,PS_frame_avg);
outputFileName = [tag2 '.tif'];
for K = 1:length(mean_mov(1,1,:))
imwrite(mean_mov(:, :, K),outputFileName,'WriteMode', ...
'append','Compression','none');
end
end
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Import, Export, and Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!