필터 지우기
필터 지우기

Detecting white color in moving video

조회 수: 3 (최근 30일)
KDN
KDN 2015년 11월 8일
댓글: Image Analyst 2015년 11월 9일
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));

답변 (1개)

Image Analyst
Image Analyst 2015년 11월 8일
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
KDN
KDN 2015년 11월 9일
편집: KDN 2015년 11월 9일
Thanks nice work, but I am getting error while running video.
Image Analyst
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by