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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Import, Export, and Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by