How Do I represent the number of dots detected? total numbers of dots detected in every snapshot of the camera
2 views (last 30 days)
Show older comments
I want to display the present, and after next snapshot the present would be a previous, total result of the dots detected in my GUI if every snapshot of the caemra at the GUI, how di i calculate it?..... this is my code..
originalImage = wa; % wa = the input image or video from snapshot
G = rgb2gray(im2double(originalImage));
B = im2bw(imfilter(G, fspecial('gaussian', sigma*3, sigma), 'replicate'), thres);
B1 = bwlabel(B);
dots = max(B1(:))
%calculate number of dots
presentdots = int2str(dots);
set(handles.pres, 'String', presentdots);
% and no idea for previous and total number of dots
0 Comments
Answers (3)
Walter Roberson
on 3 Feb 2013
totaldots = 0;
before the loop that gets the images.
After presentdots is calculated,
previousdots = totaldots;
totaldots = totaldots + presentdots;
and then format and send them to the appropriate places.
0 Comments
Image Analyst
on 3 Feb 2013
You're not doing it right. The number of dots is returned by bwlabel. Try this:
[B1, presentdots] = bwlabel(B);
% Now that we have presentdots, put up info into a label on the GUI.
myLabel = sprintf('The present number of dots = %d', presentdots);
set(handles.pres, 'String', myLabel);
3 Comments
Image Analyst
on 3 Feb 2013
I believe you already had a question on that. Either keep track of the last number of dots by setting it equal to the current number of dots, or just make the number of dots an array where each index is the number of dots for that image or iteration.
See Also
Categories
Find more on MATLAB Report Generator 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!