Effacer les filtres
Effacer les filtres

Detecting white color in moving video

3 vues (au cours des 30 derniers jours)
KDN
KDN le 8 Nov 2015
Commenté : Image Analyst le 9 Nov 2015
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));

Réponses (1)

Image Analyst
Image Analyst le 8 Nov 2015
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 commentaires
KDN
KDN le 9 Nov 2015
Modifié(e) : KDN le 9 Nov 2015
Thanks nice work, but I am getting error while running video.
Image Analyst
Image Analyst le 9 Nov 2015
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?

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by