我正在对视频帧进行基于平均偏移颜色的图像分割。这是我的代码:
while hasFrame(v)
if k == 1
s(k).cdata = readFrame(v);
a = s(k).cdata;
I = imresize(a,[50,50]);
[means, Ims, Nms] = Ms(I,bw); %Mean Shift on first frame
Ims = im2uint8(Ims);
s(k).cdata = Ims;
else
s(k).cdata = readFrame(v);
a = s(k).cdata;
I = imresize(a,[50,50]);
[Ims,data2cluster]= MeanShiftCluster2(I,means); % simple segmentation based on norm using means of first frame
Ims = im2uint8(Ims);
Ims = imresize(Ims,[500,720]);
s(k).cdata = Ims;
end
k=k+1;
end
我正在发送第一帧以实现均值偏移,然后对所有其他帧使用相同的结果均值,以根据欧几里德距离计算它们各自的集群(我的帧有微小的变化)。
问题:Profiler 告诉 iamresize 和 VideoReader 函数执行时间过长。有没有我可以使用的替代品?