Shadow Detection from rgb video strem
3 views (last 30 days)
Show older comments
Hi everyone,
I need help in this code that I wrote in shadow detection but the function is stoping in the (IF)
and send the message
Operands to the || and && operators must be convertible to logical scalar values.
Error in ziad (line 46)
if( w>=alphaV || w<=betaV || sat<=-0.3 || hue <=0.2)
clc
clear
mov = VideoReader('car_s.avi');
path1='ziad\VideoFrame\';
path2='ziad\cfhue\';
path3='ziad\cfsatur\';
path4='ziad\cfValue\';
path5='ziad\imagesinRGB\';
mkdir(path1);
mkdir(path2);
mkdir(path3);
mkdir(path4);
mkdir(path5);
alphaV=0.2;
betaV=0.8;
[m,n]=size(mov);
single=zeros(m,n);
%
n=0;
while hasFrame(mov)
frame = readFrame(mov);
pf5=strcat(path5,num2str(n),'.jpg');
imwrite(frame,pf5)
bac=imread('C:\Users\Dr.Zee\Desktop\Shadow detection\ziad\imagesinRGB\23.jpg');
bchsv=rgb2hsv(bac);
bchue =bchsv(:,:,1);
bcsat =bchsv(:,:,2);
bcVal =bchsv(:,:,3);
im=rgb2hsv(frame);
pf1=strcat(path1,num2str(n),'.jpg');
% figure(1)
% imshow(im);
n=n+1;
imwrite(im,pf1)
cfh=im(:,:,1);
pf2=strcat(path2,num2str(n),'.jpg');imwrite(cfh,pf2)
cfs=im(:,:,2);
pf3=strcat(path3,num2str(n),'.jpg');imwrite(cfs,pf3)
cfv=im(:,:,3);
pf4=strcat(path4,num2str(n),'.jpg'); imwrite(cfv,pf4)
w= cfv-bcVal;
sat=cfs-bcsat;
hue=cfh-bchue;
if( w>=alphaV || w<=betaV || sat<=-0.3 || hue <=0.2)
single=1;
else
single=0;
end
end
%
%
% figure;
% imshow(single);
0 Comments
Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!