Undefined function 'preview' for input arguments of type 'struct'.
조회 수: 2 (최근 30일)
이전 댓글 표시
Hai I am using Back round subtraction method on frame.Now I want to see the preview of these frames.But Error is occured " Undefined function 'preview' for input arguments of type 'struct'. This is code:
if true
for i = 2:numFrames
%fr = vid(i).cdata;
% read in frame
fr= read(vid, i);
fr_bw = rgb2gray(fr); % convert frame to grayscale
fr_diff = abs(double(fr_bw) - double(bg_bw)); % cast operands as double to avoid negative overflow
threshHold=mean(fr_diff);%Experimetn
for j=1:width % if fr_diff > thresh pixel in foreground
for k=1:height
if ((fr_diff(k,j) > threshHold))
fg(k,j) = fr_bw(k,j);
else
fg(k,j) = 0;
end
end
end
bg_bw = fr_bw; %store old frame to bg_bw variable
imshow(fr_bw);
figure(1),subplot(3,1,1),imshow(fr)
subplot(3,1,2),imshow(fr_bw)
subplot(3,1,3),imshow(uint8(fg)) ;
z=i-1;
q(z) = im2frame(uint8(fg),gray(256)); % put frames into movie
preview((q(z)));
end end
댓글 수: 0
답변 (2개)
Guillaume
2016년 5월 4일
preview does not appear to be a function of base matlab nor any of its toolboxes, so it must be a function that you've written yourself. Make sure that it is visible to matlab by adding its folder to matlab's path.
댓글 수: 0
Steven Lord
2016년 5월 4일
There are a couple of objects in MATLAB that have preview methods. For instance, video input objects in Image Acquisition Toolbox have a preview method as do DatabaseDatastore objects in Database Toolbox and general datastore objects in MATLAB.
But there's no preview function or method for struct arrays.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!