Detecting white color in moving video
3 ビュー (過去 30 日間)
古いコメントを表示
What change I have to do in given code below to detect white color from video and get it's brightness.
snap_red = imsubtract(snap(:,:,1), rgb2gray(snap));
0 件のコメント
回答 (1 件)
Image Analyst
2015 年 11 月 8 日
See my demo http://www.mathworks.com/matlabcentral/fileexchange/28512-simple-color-detection-by-hue It would be something like this
hsvImage = rgb2hsv(double(rgbImage));
h = hsvImage(:,:,1);
s = hsvImage(:,:,2);
v = hsvImage(:,:,3);
whitePixels = s < 0.2 & v > 0.8;
or something like that.
whitePixels is a binary image, or "mask". Feel free to modify the parameters.
See my demo where I track a green Sharpie pen.
2 件のコメント
Image Analyst
2015 年 11 月 9 日
It works for me. Was that for my demo video, or for one of yours? If you put a breakpoint on this line and execute it,
% Setup other parameters
numberOfFrames = videoObject.NumberOfFrame;
what does it say numberOfFrames is? Is the videoObject a valid object?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!