我的项目是"视频中火焰检测的光流估计"在提取特征值时,我只能保留帧的最后一个强度值。
这是我的代码
function [Iy, Ix, It] = grad3D(imNew,bFineScale,bInitialize)
persistent siz gx gg imPrev;
if nargin>2 && bInitialize
[gx, gg]= makeFilters();
if bFineScale
siz = size(imNew);
imPrev= single(imNew);
else% if ~bFineScale
siz = floor(size(imNew)/2);
%initialize imPrev to half the size
imPrev = imresizeNN(single(imNew),siz);
end
end
if ~bFineScale
imNew = imresizeNN(conv2(single(imNew),gg,'same'),siz);
else imNew = single(imNew);
端
Ix = conv2(gg,gx,imNew + imPrev,'same');
Iy = conv2(gx,gg,imNew + imPrev,'same');
It = conv2(gg,gg,imNew - imPrev,'same'); %L3
最后%,存储当前图像以供下一帧使用 imPrev = imNew; testfeature = mean(imPrev); 保存testfeature testfeature
[gx, gg]= makeFilters() x = (-1:1);
gg = single(gaussgen(0.67,3));
gx = single(-x.*gg*3);
突出显示的编码(testfeature=mean(imprev)
)。我只能获得最后一帧提取的强度值...但我需要所有提取帧的值。我需要将值存储在矩阵文件中。