Read Video and subtract color

1 view (last 30 days)
Raoul Can
Raoul Can on 27 Jan 2016
Edited: Raoul Can on 28 Jan 2016
Hello,
I can open a video and convert to gray scale. But how can i subtract a color like red from grayscale? diff = imsubtract(vid(:,:,1),rpg2gray(vid)) didn't work.
I get the Error:
Error using rgb2gray>parse_inputs (line 77)
MAP must be a m x 3 array.
Error in rgb2gray (line 52)
[X, threeD] = parse_inputs(X);
Error in VideoTracking_Color_Version2 (line 52)
sub_imgObj = imsubtract(imgObj(:,:,1), rgb2gray(imgObj(k)));
And this is a part of the code: hThresholds = [0.799, 0.990]; sThresholds = [0.480, 0.999]; vThresholds = [66, 202];
for k = 1:nFrames
imgObj=read(videoObject,k);
sub_imgObj = imsubtract(imgObj(:,:,1), rgb2gray(imgObj(k)));
...

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!