ECG信號(hào)數(shù)字化處理技術(shù)
ECG信號(hào)是一維的數(shù)據(jù)。一般被記錄在熱敏紙上。不便于保存和處理。可以先用掃描儀,至少300DPI的分辨率,掃描下來(lái)。
使用PHOTOSHOP的旋轉(zhuǎn)將圖旋轉(zhuǎn)到正確方向。使用魔棒工具 容差50 連續(xù) 將相應(yīng)圖線選出。反選后將背景的格子顏色,及說(shuō)明去除。圖像模式改為灰度,去除顏色。再交圖像模式改為位圖。50%閾值。另存成bmp文件。
然后使用下面的程序轉(zhuǎn)換。bmp文件被讀入MATLAB中,并查找非空邊沿,然后再做一維數(shù)字化。bmp圖像轉(zhuǎn)換成對(duì)應(yīng)文件名的文本文件,文本文件可以導(dǎo)入EXCEL或其它可以接受數(shù)據(jù)的程序中。數(shù)據(jù)以科學(xué)計(jì)數(shù)法表示。
% remove blank line and digitalize
% try to find 4 boundery and put it to
% an txt file
% 4 bounder is bup bdown bleft bright
%
% usage: removeblank 'filename' filename must be a bmp file
function y = removeblank( x )
a = imread(x,'bmp');
for i = 1 : length(a(:,1))
if(length(find(a(i,:))) ~= 0)
bup = i;
break;
end
end
for i = length(a(:,1)) : -1 : 1
if(length(find(a(i,:))) ~= 0)
bdown = i;
break;
end
end
for i = length(a(1,:)) : -1 : 1
if(length(find(a(:,i))) ~= 0)
bright = i;
break;
end
end
for i = 1 : length(a(1,:))
if(length(find(a(:,i))) ~= 0)
bleft = i;
break;
end
end;
% 4 boundery found
fid = fopen(['dg',x,'.txt'],'W');
for i = bup : bdown
b = find(a(i, bleft : bright));
if(length(b) == 0)
c(i - bup + 1) = c(i - bup)
else
c(i-bup + 1) = sum(b)/(length(b));
end
fprintf(fid,'%6dn',c(i-bup + 1));
end;
plot(c);
fclose(fid);
%imwrite(a(bup : bdown, bleft : bright),['rb',x] ,'bmp');
評(píng)論