Author Archives: Rex Hardin

About Rex Hardin

Some say... I am the stig! Others just call me a geek/nerd/dork. :D

Spectrum – Javascript Color Picker

I’m building a website to sort of mimic the functionality of StudioStyl.es (awesome site for Visual Studio theme lovers!) for PowerShell ISE color themes!

I’ll be doing things a little differently. Colleagues have suggested using PowerShell as the primary scripting language for the site, and while that’s feasible it seems like overkill (if not convoluted) at this point. Not sure if I’ll head in that direction – in the meantime, I’m playing with javascript color pickers!

The Spectrum color picker is proving really handy: http://jsfiddle.net/W6WCD/1/

5,411 total views, no views today

OCR with Powershell

I wrote a little function that utilizes Microsoft Office Document Imaging (MODI) to retrieve text from images with OCR.

I have put a few notes in-line in the script and have dummy-proofed it somewhat, but ymmv! Below the snippet I’ll show an example where I compare 12pt font recognition with this technique.

Here’s an example:

Image Get-TextFromImage Output
OCR Test Image Windows Powershell NODI OCR Test Image
l2pt COURIER NEW ABCDEFGHIJKLMNOPORSTUVLJXYZ
abcdefghijklmnopqrstuvwxyz
01234567890 

12 pt TAHOMA
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789

12 pt TERMINAL
ABCDEFCH I JICLMNOPQRSTUUIIXYZ
abc de f gh ii Ic inn o pqrs t tw wxyz
0123456789

12 pt VERDANA
ABCD EFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789

12 pt CONSOLAS
ABCDE FCHIJ KL KNOPQRSTUVHXYZ
abcdefghij kirnnopqrst uvwxyz
0123456789

12 pt Times New Roman
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklnmopqrstuvwxyz
0123456739

] pt OCR?A Extended ABCDEFGHI JKL1NOPQRSTUVLdXYZ
abcde fghij kimnopqrstuvwxy z
O]3456789

The OCR-specific font failed miserably. Funny huh?

It appears that at 12pt in a jpg, Times New Roman is the best candidate for OCR using MODI via Powershell if you intend on having accurate results!

Relevant links:
http://stackoverflow.com/questions/316068/what-is-the-ideal-font-for-ocr
http://cerealnumber.livejournal.com/47638.html
http://stackoverflow.com/questions/9277571/how-can-i-retrieve-modi-reference-from-com-in-my-application

16,814 total views, 3 views today

Get-OpenfileIDs

Something I’m twiddling with… you could also use the “openfiles.exe” command, which supports wildcarding IDs. Dunno where this snippet would be totally useful.

1,917 total views, no views today