how to display string over image for scene labeling?

Réponses (2)

Walter Roberson
Walter Roberson le 7 Déc 2013

0 votes

text()

3 commentaires

can u give me the sample code..
xpos = 5;
ypos = 3.9;
text(xpos, ypos, 'this is a label')
i need to write string over an image.. how to code?
Thank You Sir.

Connectez-vous pour commenter.

>> a = imread('Image_File');
>> binary = im2bw(a);
>> l = bwlabel(a_b,4);% 4 or 8 we can choose according to our requirement
>> [r, c] = find(l==2);
>> rc = [r c];
>> imshow(l == 2)
>> s = regionprops(l, 'Centroid');
>> imshow(a_b)
>> for k = 1:numel(s)
c = s(k).Centroid;
text(c(1), c(2), sprintf('%d', k),'HorizontalAlignment', 'center','VerticalAlignment', 'middle');
end
hold off
if you problem is solved accept the answer :-)

Catégories

En savoir plus sur Read, Write, and Modify Image dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by