Averaging tiff frames and writing - movie is all white?

1 回表示 (過去 30 日間)
Pavlov
Pavlov 2014 年 7 月 16 日
コメント済み: Pavlov 2014 年 7 月 16 日
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

採用された回答

Image Analyst
Image Analyst 2014 年 7 月 16 日
Cast mean_mov back to uint8 before you display it or write it to disk.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by