Detection only occurring on the left side
Show older comments
Why is detectiong only occuring on the left side? Is it because it has not finished "processing" while going through the frames? How can it git me all the results?

Here is the code:
subplot(1,3,1);
videoFrame1 = imread("videoShot.png");
imshow(videoFrame1);
vidReader = vision.VideoFileReader("shortZebraVideo.mp4");
vidReader.VideoOutputDataType = 'double';
diskElem = strel('diamond',1);
hBlobAn = vision.BlobAnalysis('MinimumBlobArea',1,... ...
'CentroidOutputPort', true);
vidPlayer = vision.VideoPlayer;
while ~isDone(vidReader)
vidFrame = step(vidReader)
% Convert RGB image to chosen color space
Ihsv = rgb2hsv(vidFrame);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.004;
channel1Max = 0.002;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.000;
channel2Max = 1.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.000;
channel3Max = 0.312;
% Create mask based on chosen histogram thresholds
sliderBW = ( (Ihsv(:,:,1) >= channel1Min) | (Ihsv(:,:,1) <= channel1Max) ) & ...
(Ihsv(:,:,2) >= channel2Min ) & (Ihsv(:,:,2) <= channel2Max) & ...
(Ihsv(:,:,3) >= channel3Min ) & (Ihsv(:,:,3) <= channel3Max);
Ibw = sliderBW;
Ivbwopen = imopen(Ibw, diskElem);
[areaOut, centroidOut, bboxout] = step(hBlobAn,Ivbwopen);
frameMarkers = insertMarker(vidFrame, centroidOut);
vidPlayer.step(frameMarkers);
end
Accepted Answer
More Answers (0)
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!