glyph bounding boxes
Posted: 2009-09-17T16:18:42-07:00
I am a new user of ImageMagick++. I am attempting to create test images for optical character recognition analysis. For each glyph, I want to determine the bounding box coordinates of that glyph as it is added to the image. Some glyphs may be rotated slightly, and they will not necessary be aligned on a straight baseline. How do I determine the bounding box pixel coordinates for a single glyph that has been drawn onto my main image?
Using the code below, I can specify where the corner of the glyph begins, but after it is drawn I do not know the bounding box coordinates (the height and width of the glyph).
Using the code below, I can specify where the corner of the glyph begins, but after it is drawn I do not know the bounding box coordinates (the height and width of the glyph).
Code: Select all
Image myimage("200x200", "white");
myimage.magick("PNG");
myimage.fillColor("black");
myimage.fontPointsize(16);
myimage.boxColor("orange");
list<Drawable> draw_list;
DrawableFont myfont("Arial");
draw_list.push_back(myfont);
DrawableText drawText(101, 50, "X");
draw_list.push_back(drawText);
myimage.draw(draw_list);