Averaging tiff frames and writing - movie is all white?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Import, Export, and Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!