filename = 'success_Trim3.mp4';
hvfr = VideoReader(filename);
hblob = vision.BlobAnalysis( ...
'AreaOutputPort', false, ...
'BoundingBoxOutputPort', false, ...
'OutputDataType', 'single', ...
'MinimumBlobArea', 7, ...
'MaximumBlobArea', 300, ...
hVideo = vision.VideoPlayer;
hVideo.Position(1) = round(hVideo.Position(1));
hVideo.Position(2) = round(hVideo.Position(2));
hVideo.Position([4 3]) = 30+VideoSize;
image = rgb2gray(im2single(readFrame(hvfr)));
y1 = 2*image - imdilate(image, strel('square',7));
y2 = imdilate(y1, strel('square',7)) - y1;
Centroid = step(hblob, y3);
numBlobs = size(Centroid,1);
frameBlobTxt = sprintf('Frame %d, Count %d', frameCount, numBlobs);
image = insertText(image, [1 1], frameBlobTxt, ...
'FontSize', 16, 'BoxOpacity', 0, 'TextColor', 'white');
image = insertText(image, [1 size(image,1)], ackText, ...
'FontSize', 10, 'AnchorPoint', 'LeftBottom', ...
'BoxOpacity', 0, 'TextColor', 'white');
image_out = insertMarker(image, Centroid, '*', 'Color', 'green');
frameCount = frameCount + 1;