필터 지우기
필터 지우기

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 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