From: ImageAnalyst on
Well again, it's not word for word what I posted. You cut out this
key portion:

% Threshold the image to get a binary image (only 0's and 1's) of
class "logical."
% Method #1: using im2bw()
% normalizedThresholdValue = 0.4; % In range 0 to 1.
% thresholdValue = normalizedThresholdValue *
max(max(originalImage)); % Gray Levels.
% binaryImage = im2bw(originalImage,
normalizedThresholdValue); % One way to threshold to binary
% Method #2: using a logical operation.
thresholdValue = 100;
binaryImage = originalImage > thresholdValue; % Bright objects will
be the chosen if you use >.
% binaryImage = originalImage < thresholdValue; % Dark objects will
be the chosen if you use <.

I guess you removed that portion because you assumed that you were
importing an image that was already binary (which it wasn't). So
after you convert it to monochrome, you still need to do what I did
above, namely threshold the image.

Read the comments carefully because they say how to threshold the
image to get white objects on a black background. Your objects are
dark so you have to follow the comment for getting dark objects (which
is commented out because in my example I had bright objects on a dark
background - the opposite of you.)
From: Akshay Chaudhari on
Thank you so much! The problems I was having make sense now, thanks to you. I really appreciate your time. Thanks for being so active on the forums.

You're a beast :)
From: ImageAnalyst on
You're welcome!