如何解决此错误。由于此视频上传需要太多时间。首先,我正在读一个细胞。然后创建从视频中提取的帧的直方图,然后将其与任何前一帧进行比较,并仅在直方图之间存在任何显着差异时上传。
global currRowIndex;
global histCell;
if (fname ~= 0)
file_fullpath = strcat(pthname, fname);
[pathstr, name, ext] = fileparts(file_fullpath);
mov=VideoReader(file_fullpath);
data = read(mov, Inf);
nFrames=mov.NumberOfFrames;
parfor k = 1: nFrames
waitbar(k/nFrames);
if(k==1)
index=currRowIndex;
cell=histCell;
currentFrame = read(mov, k);
imgHSV=rgb2hsv(currentFrame);
H = imgHSV(:,:,1);
S = imgHSV(:,:,2);
V = imgHSV(:,:,3);
hHist = hist(H(:),16);
sHist = hist(S(:),16);
vHist = hist(V(:),16);
index=index+1;
cell(index,:,:,:,index)={name;hHist;sHist;vHist;categorySelected};
else
currentFrame = read(mov, k);
imgHSV=rgb2hsv(currentFrame);
H = imgHSV(:,:,1);
S = imgHSV(:,:,2);
V = imgHSV(:,:,3);
hHist = hist(H(:),16);
sHist = hist(S(:),16);
vHist = hist(V(:),16);
[rowCurr,colCurr,depthCurr]=size(cell);
found=0;
if(row==0)
row=1;
end
for x=row:rowCurr
dbRow=cell(x,:,:,:,x);
H_Temp= getDiff(dbRow{2},hHist);
if(H_Temp>2000 && dbRow{5}==categorySelected)
found=1;
break;
end
end
if(found==1)
index=index+1;
cell(index,:,:,:,index)={name;hHist;sHist;vHist;categorySelected};
end
end
end
我得到的错误如下
???引用已清除的可变单元格。
Error in ==> FrmUploadVideo>(parfor body) at 133
[rowCurr,colCurr,depthCurr]=size(cell);