Skip to content

getting ros nxt out of the closet

This package isn’t installed by default

sudo apt-get install python-nxt

make sure quotes are there. should probably just be 660, i changed it while i was having issues

cat /etc/udev/rules.d/70-lego.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", GROUP="lego", MODE="0666"

reading from the sensor

rostopic echo my_touch_sensor

moving the motor

rostopic pub -1 joint_command nxt_msgs/JointCommand -- motor_joint 0.9

To use the base nxt packages with the nxt_robots package you will need to chain together the catkin workspaces


Induction heating to remove seized bolt

Working on replacing the timing chain gasket on my 99 ford explorer 5.0

got to the point of some seized bolts and not sure what to do.

using a big blow torch sounds like it would work best but I don’t have one and I don’t want to strip my motor down enough to do it safety.

After a while I remembered inductive heating. Fortunatly there is a tool for that! Unfortunatly it is like $500. But it works really well!

After some more thinking I decided to go more of the DIY route and bought this for $13.

I needed a power supply so I grabbed an old PC power supply. Using some yellow 12 volt wires and the black ground wires. Needed to add a power button by bridgeing the green and black wires on the 20 pin connector

Yay it heats up a paper clip to red hot in about 8 seconds!

I needed some sort of project case to use in the actual repair!

The bolt I needed to heat up was larger then a paperclip so it took longer to heat up. Doing a bench test after about 2 minutes I was able to get the bolt to about 600 degrees!

In the end I couldn’t generate enough heat when the bolt was in the block using the $13 inductive heating unit. A $55 handheld torch did the job.

Gasket replaced!

after fixing dpi what else can you do?

fix DPI (if needed) 300 DPI is minimum
fix text size (e.g. 12 pt should be ok)
try to fix text lines (deskew and dewarp text)
try to fix illumination of image (e.g. no dark part of image
binarize and de-noise image

User Scenario: Process digital camera pictures and OCR to extract specific numbers

DPI and you?

I have been experimenting with tasseract and occasionally get really terrible results when I know I should not. When I grab the images, change the dpi aka save them at a different resolution I get great results.

Tasseract wants 300 dpi. when I google dpi of digital images or how to change dpi on android most of the information is along the lines of “you dont want dpi, you dont know what you are talking about, your life is a lie and nobody cares about you”. So what is going on here?

Maybe some more details from Tasseract will help:

Is there a Minimum Text Size? (It won’t read screen text!)
There is a minimum text size for reasonable accuracy. You have to consider resolution as well as point size. Accuracy drops off below 10pt x 300dpi, rapidly below 8pt x 300dpi. A quick check is to count the pixels of the x-height of your characters. (X-height is the height of the lower case x.) At 10pt x 300dpi x-heights are typically about 20 pixels, although this can vary dramatically from font to font. Below an x-height of 10 pixels, you have very little chance of accurate results, and below about 8 pixels, most of the text will be “noise removed”.

So it looks like they want the letters to be within a certain range of pixels tall. They only give minimum pixels here, around 20 pixels minimum. But I believe there is also a maximum pixel height they will look for. In my previous post ‘tesseract’ small unclear text was picked up reliably but large very clear text was ignored. From what I can find on google it does not appear there is a configured maximum but a algorithm that tries to determine it based on picture height.

My current image is 115 x 59 and the text is about 1/3 of that height or about 19 to 20 pixels high. It seems silly to my that doubling the pixels in the picture with no quality improvement would yield better results but I guess I can give it a try.

So my next steps will be

  1. Make sure my text is above the minimum pixel xheight by a safe margin
  2. study up more on the max height algorithm. maybe I just need to zoom out?

building AnySoftKeyboard

Trying to build anysoftkeyboard

android update project -p .
Error: . is not a valid project (AndroidManifest.xml not found).

cool, the android manifest is actually a couple directories deep. ill skip this for now

next step

gradle build
:buildSrc:compileJava UP-TO-DATE

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:compileGroovy’.
Cause: You must assign a Groovy library to the groovy configuration!

* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.


Total time: 2.374 secs

well that went well. Probably because I have a super old version of gradle by default with ubuntu that doesnt include the groovy configs by default.

Installing the latest and greatest gradle fixed it. Overall I enjoy apt-get but this seems to be a recurring problem!

arduino keyboard wedge

source for example keyboard

Had to fix preferenceActivity by adding is valid fragment true

git clone of softkeybaord

android google repos

this looks pretty spot on to what i want to do

going to base off new keyboard

Zoom in android app

trying out (another) android-ocr app

After getting my feet wet with the simple app in my last post I wanted to try a little bit more advanced app.

Getting it running was pretty straight forward.

  1. git clone android-ocr
  2. made sure it was pointing at tess two
  3. right clicked on project and ran as android app


it works pretty well. thoughts

  • I dont need the translation stuff so I will rip that out.
  • zoom would be nice for when you are a little farther away
  • there is some code for continuous recognition, that sounds neat but im not sure how to enable it
  • it would be nice to prompt the user if this is correct, save the files

Starting out with Simple-Android-OCR on ubuntu

pretty boring post. basically followed this tutorial

  1. make sure you have the build toolssudo apt-get install build-essential
    sudo apt-get install ia32-libs
    sudo apt-get update
    sudo apt-get install ia32-libs
    sudo apt-get install openjdk-6-jdk
    sudo apt-get install icedtea-plugin
  2. install android sdk
  3. install android ndk
  4. add adt tools to your path and .bashrc
  5. build tess-two
    git clone git:// tess
    cd tess/tess-two
    fix target in
    android update project –path .
    ant release
  6. build eyes-two
    cd ../eyes-two/
    fix target in
    android update project –path .
    ant release
  7. build simple-android ocr
    git clone Simple-Android-OCR
    go change target version in properties file
    point the project at the tess two install path
  8. I had trouble getting my phone to allow the debug connection. “adb devices” would either return nothing or the device serial number as question marks or the status as unauthorized. I tried several combinations of restarting adb along with restarting the phone, unplugging and replugging, disabling / enabling dev mode. I think is what finally did it was removing all currently authorised computers from my phone.ANDROID_SDK_HOME=~/adt-bundle-linux-x86-20140702/sdk
    and add to .bashrc
    2015 adb kill-server
    2016 adb start-server
    2017 adb devices
  9. open eclipse, right click on simple ocr project and run as android application.
  10. success!


Tesseract is probably the most accurate open source OCR engine available. It differs from OpenCV because opencv is a general purpose image library. You could use it to build something like Teseeract.

How well does it work? I downloaded the latest portable version to try it out. The ReadMe is very helpful.


out of the box

Out of the box just point it at an image.

>tesseract.exe IMG.JPG out
>cat out.txt


.‘-go.-—: qv..»- . v_—
r : -.; 1


Lp LMT 223500

_ ‘ -r~,.\’4-5-p-—-A-. 4.
ts‘ “3′ ”’


..,. …¢…-..

,, ..–4

Pretty impressive that it correctly read the small text at the bottom but pretty said it missed the giant text in the middle.

focus on digits

Maybe if I focus on digits I can get the big “352264”.

In Tesseract-OCR\
>cat tessdata\configs\digits
tessedit_char_whitelist 0123456789
>tesseract.exe IMG_4311.JPG out digits
>cat out.txt


20522024 0101022 2 222
1 2 252 0

17 0011

00 1001 223500

2 0 0554112402 42
2200 11 000

2 10168 512 60009 551053

2402 0242402

202 0224

So my guess is the letters are too big compared to the size of the picture. Tesseract is really geared towards looking at a page of text so it would make sense to ignore larger patterns and focus on smaller ones.

general approach for best results from tasseract

according to this stack overflow post

  1. fix DPI (if needed) 300 DPI is minimum
  2. fix text size (e.g. 12 pt should be ok)
  3. try to fix text lines (deskew and dewarp text)
  4. try to fix illumination of image (e.g. no dark part of image
  5. binarize and de-noise image

fix DPI

The original dpi of the image was 72. Probably a setting in the camera that could be changed, or changed automatically with pre processing.

As a quick test I changed the dpi in gimp to the recommended 300.

>tesseract.exe 300dpi.JPG out
>cat out.txt

_`__ ___`___,.. ….-u-9.`-“”

._ , ,~…,.–… ….

..- …-..-…….

..,\.-.,~. –
,, .. ….~\-.»..v
, ., ._..x-. o-






V.`-w-v -2
”’-_§_“’.: ‘. `

QLD LMT 223500
`L1 WT 62500

_ . ‘ “.”..”4-1`
.:…–“!CT::~ ts`


Success! I got the string CHTT 352264 I was looking for. But there is still a bunch of junk..

only allow alpha numeric

In Tesseract-OCR\
>cat tessdata\configs\alphanumeric
tessedit_char_whitelist 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
>tesseract.exe IMG_4311.JPG out alphanumeric
>cat out.txt

V1 HFR4 9P

A 4 N NW

H 4 N







V 4

V1 2

3 LD LMT 223500
LT WT 62500

P P 41
A IQ17 M


what is next?

  • use regex to limit the pattern I want
  • pre-process the image more, possibly only look at largest text