aviファイルをtiffファイルに変換し画像処理した後,再び画像をaviファイルに変換しようとしたのですが,添付のエラーがでてしまいます.どうすればこのエラーを避けることができるでしょうか?他のtiffファイルをaviファイルにする際には同じコードで問題なく処理できます.verはR2013aです.
4 views (last 30 days)
Show older comments
clc
clear all
close all
%%データ処理設定
%画像読み出し&保存先
image_dir='G:\研究\各種解析\temp\処理後\Run8_brio';
save_dir='G:\研究\各種解析\temp\処理後';
%保存dir&aviファイル保存名
savename=['Run8_B'];
save_dir0 = [save_dir '\' savename];
mkdir(save_dir0);
%保存の有無(保存なら1しないなら0)
sav = 1;
%スタートエンド画像番号 for background
RUNframe_st=101;
RUNframe_ed=230;
%スタートエンド画像番号 for background
BGframe_st=1;
BGframe_ed=50;
%閾値(画像輝度値)
threshold=50;
%画像処理エリア
x1=1;
x2=1280;
y1= 1;
y2= 720;
%ガンマ値
gamma=1.0;
%強度値の設定
low_in=0;
high_in=2^16;
low_out=0;
high_out=2^16;
%カメラダイナミックレンジ
Drange=2^16;
low_in=low_in/Drange;
high_in=high_in/Drange;
low_out=low_out/Drange;
high_out=high_out/Drange;
%Passの設定
run_dir=[image_dir '\'];
run_file=[''];
%%background画像作成
num=BGframe_ed-BGframe_st+1;
BG_signal=zeros;
n=0;
for nn=BGframe_st:BGframe_ed
n=n+1;
Image=sprintf('%s%s%03d.tiff',run_dir,run_file,nn);
X=imread(Image);
BG_signal=BG_signal+X;
end
SumBG=BG_signal;
AveBG=BG_signal./double(num);
%%bg減算+Threshold+16bit化+imaadjust+動画作成
num2=RUNframe_ed-RUNframe_st+1;
RUN_signal=zeros;
n=0;
for nn=RUNframe_st:RUNframe_ed
n=n+1;
Image=sprintf('%s%s%03d.tiff',run_dir,run_file,nn);
X=imread(Image)-AveBG;
X(X<threshold)=0;
X =imadjust(X,[low_in high_in],[low_out high_out],gamma);
X =uint16(X);
X =fliplr(X);
figure(1)
imagesc(X)
colormap(gray)
caxis([50,200])
axis image
axis off
set(gcf,'color','white');
F(nn) = getframe(gcf);
if sav==1
saveas(gcf, [save_dir0 '\' run_file, num2str(nn) '.tiff']);
end
end
if sav==1
movie2avi(F,[save_dir0 '\' savename '.avi'],'fps',15);
end
0 Comments
Answers (1)
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!