MATLAB Answers

How to Count Not Counted Objects on Image Processing

3 views (last 30 days)
Murat Kocaman
Murat Kocaman on 30 Jul 2018
Commented: Murat Kocaman on 31 Jul 2018
I have attached photo as a result of image object count with image processing.
As it seems obviously, some objects are not counted. At this result I would like to add manual count function to count uncounted objects manually. Also, there are some over counts.
How could I add manual count and extract function to add uncounted ones and extract over counts with the numbers 11 and 4 ?
What I want to do is to add numbers for the arrowed ones by mouse clicking on it.
Is there a way to do this?

  1 Comment

Murat Kocaman
Murat Kocaman on 31 Jul 2018
I think I should have adapted this into my code but I can not play on my result image with counting numbers.
Maybe you could help at this point?
% Display an image.
hold on;
% Initialize counter.
count = 0;
message = sprintf('Click as many points as you want.\nHit return when done.');
title(message, 'FontSize', 20);
button = questdlg(message, 'Continue?', 'OK', 'Cancel', 'OK');
drawnow; % Refresh screen to get rid of dialog box remnants.
if strcmpi(button, 'Cancel')
% Begin loop where user clicks points over display (plot or image or whatever).
while count < 1000 % or whatever failsafe you want.
% User clicks one point. If user types Enter/Return, x is empty.
[x,y] = ginput(1);
if isempty(x)
% Put a cross over the point.
plot(x, y, 'r+', 'MarkerSize', 24, 'LineWidth', 3);
% Increment the count.
count = count + 1
% Save coordinates (if desired).
allX(count) = x;
allY(count) = y;

Sign in to comment.

Answers (0)


Community Treasure Hunt

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

Start Hunting!