Using a TRS-80 to find a bug with the image rotator in OneNote



    One of my hobbies which I never have time for is playing around with my old TRS-80 Color Computer. For those that remember this old machines, the majority of software was distributed in magazines and books, and you had to type the code in yourself to run the programs. If the author wrote good code, you learned quite a bit, and if not, you had fun debugging…


    A few days ago an email request came in to the Coco mailing list for a copy of an old program the writer of the email remembered as being named “JOT” and was a three letter word guessing game. Derek, the fellow looking for the program, mentioned he wanted to update the game to use a speech pack or something similar. I had never heard of this, but checked one of my old “TRS-80 Color Programs” books from Radio Shack and found it. I sent Derek a scan of the pages and then decided to see if I could get the program up and running myself. MESS is a fantastic emulator for these old 8 bit machines and newer builds let you paste text into the emulator instead of typing. I decided to scan the pages of the book, let OneNote perform its Optical Character Recognition (OCR) on the text and see how well it converted old BASIC code to text. I figured I could clean up the code in OneNote since its editor is much better than the old TRS-80 and paste away.


    Scanning the book was relatively simple. I had one snag when the cover of the book accidentally hit the power button on my HP-5280 scanner. Since I was only scanning one page at a time, I flipped the book upside down every other scan knowing I could use the image rotator to flip the scan back. Here are the first two scans after I flipped the second image around:


    clip_image001


    The text for the first image wasn’t too bad (an excerpt):


    330 PRINT”(THIS TAKES ME A WHILE …)“


    340 FOR A=N TO 100 STEP —1


    350 B:RN0cA)COSUB fi000;NEXT


    360 PRINT:O=RND(N)


    370 PRINT”I’VE ALMOST GOT IT ..“


    38!) FOR A—99 TO 2 STEP —i


    390 E:=RND(A:COSuB 4000:NExT


    400 lls=As(a):PRINT


    410 PRINT”OK DO YOU WANT TO “


    420 INPUT”GO FIRST”Q$


    430 O$LEFT$(Q$,1)


    Image for the flipped page:


    clip_image002


    But the text for the second (flipped) image was a complete mess:


    1sd 009Z ..a.oii ]V331INI>d 0901
    OLOZ 0601 NJH.L 0<>4 dl OSOT
    •ld 090Z oooc snsoj
    Iid 0S0 $dt.ajg !33 IflOA S,1LHM,.1fldNI OCOT
    D J 00 1NI ooi
    I 0C0 •.; 3No SINIHWOS1N1J 0101
    =sc 0Z0Z NId 0001
    OIOZ NJfl1 066
    Id 000Z 0fr6 N3H.L r=<i dl 086
    X3N OIfrI 0001 NH T> dl


    Here’s what happened. When I scanned the second image, OneNote ran the image through its OCR logic and generated the text it thought was in the image. Then I rotated it, but for performance reasons, OneNote doesn’t send the image through OCR again. (If you’ve ever copied text from an image and had to wait while OneNote shows the “Recognizing text in pictures” dialog, you’ll know how long your computer takes to analyze the image).


    So this is a design flaw in the image rotator. When an image is rotated, the code should remove the list of words associated with the image and let OneNote re-analyze the image after rotation. I verified this would work by using OMSpy to remove the OCR data from an image and updating the page, if you want to follow along with it. Simply copying the image within OneNote also copies the OCR index, so that doesn’t work around the image rotation.


    An easier workaround for the time being is to use the screen clipper to capture the rotated image and paste it right back into place. Or, you can cut the image, paste into Paint, then copy and paste right back into OneNote. Using either method works well and this is what the text looked like after using the screen clipper to re-create the image:


    550 IF P$<> THEN 580


    560


    570 H1(CI)=9:GOTO 5000


    588 COSU8 3000


    590 IF F=1 THEN 630


    óco PRIHT”THAT’S NOT A LECAL WORD “


    610 PRIt4r” —- TRY ACAIN


    621 COla 500


    630 OP1$2GOSUB l200:Q.p


    640 ‘ooo


    650 PRINr• OF HITS ISt0


    Which is much better.


    Of the three things to do to work around the problem (use OMSpy, use the screen clipper, or re-write the addin), I prefer the screen clipper since it lets me fine tune the scans. We can also look at the code and try to work in a fix in between testing OneNote.


    Let me know what you think!


    Questions, concerns, comments and criticisms always welcome,


    John


Comments (5)

  1. Civisi says:

    Hmm. Now that I read this, I’ve had this happen to me, too. I just never bothered to figure out why because the OCR’d text wasn’t important to me.

  2. Daniel says:

    I grew up with the CoCo! I remember two finger typing in programs from those mags. Don’t I wish you could have scanned it in back then.

  3. Seth says:

    I have a far better workaround.

    It would have been much easier to first import your scanned text into MS Document Imaging.  Its OCR routine can automatically rotate pages to the correct orientation.   If you then save the file as an *.MDI file, and use Windows Explorer to drag/drop the file onto a OneNote page (choose "print to take notes"), then the pages will all come through in their correct orientations, even if some are landscape and others are portrait.  And they will all be indexed!

  4. I wanted to show the output of OMSpy in case someone wants to get very bold and use it to update the

  5. JohnGuin says:

    Hi Seth,

    Nice workaround – you may also want to check my blog entry today for a far more geeky and time consuming workaround <g>:

    http://blogs.msdn.com/johnguin/archive/2008/09/04/using-omspy-to-fix-the-bug-with-the-image-rotator.aspx

    John