If you are planning to do something with those objects, you could be interested in using regionprops. Besides the number of objects within the image, you can retrieve any other property of the objects, such as the area, centroid, orientation,....
BW = imread('text.png');
s = regionprops(BW, 'Area');
N_objects = numel(C);
For all the options, take a look at