How to measure text letter size in pixels?
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to put up a letter (x) and measure it's height and width in pixels. I would like to do it for a number of different size fonts. I thought there was a scan command that would start at the top of the screen and scan until it ran into the text, then record that value. I also would like to be able to put up two letter X's and measure the distance in pixels between them.
3 Kommentare
Image Analyst
am 13 Okt. 2016
You didn't respond to my "Answer" below. Did you see it? Will that work for you?
Antworten (2)
Image Analyst
am 13 Okt. 2016
If you have the Computer Vision System Toolbox, try insertText(): http://www.mathworks.com/help/vision/ref/inserttext.html
1 Kommentar
Walter Roberson
am 14 Okt. 2016
Create a uicontrol('style','text') and appropriate FontName, FontSize, FontUnits, FontWeight, FontAngle. Do not worry about the Position. You can set the Visibility to off. Once it has been set up, set the uicontrol Units to pixels .
Now for each character to be tested, set the String property of the uicontrol to just that one character, and then ask for the Extent property of the control. This will tell you how big the control would have to be to hold the string. Record it, keep going with the next desired character, or set the FontSize and ask again, and so on.
After you are done, delete the uicontrol.
2 Kommentare
Walter Roberson
am 14 Okt. 2016
If you want to know about how Psychtoolbox positions characters, you need to talk to the Psychtoolbox people http://psychtoolbox.org/
Siehe auch
Kategorien
Mehr zu Timing and presenting 2D and 3D stimuli finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!