Tuesday, April 30, 2013

Getting Started with Beagle Bone

I am relatively new to the Angstrom distribution on the Beaglebone Black. Compared to the Arduino and Raspberry Pi, the Beaglebone has a tremendous lack of tutorials and documentation. This makes learning on the platform much more difficult. I have linux Mint 14 on my laptop and my desktop so I am familiar with commands and navigating linux. The whole GPIO is a bit intimidating on the new boards so I decided to pick up a copy of Getting Started with the Beaglebone by Matt Richardson. It is only a $10 book and Matt has had the Beaglebone for some time prior to its release. It is currently in its raw version and does not have all the chapters released but I got the electronic copy so as the chapters are published I get notified and just download the document again. I think it will be a great help

In addition to my scanner I have done some astrophotography. I was working on a barn door tracker which rotates with the earth to give longer exposures. The Beaglebone would be great to control my DSLR or even better capture and process the images for my 3D scanner. Here is a picture of the Orian Nebula I captured awhile back.

Sunday, April 28, 2013

3D Scanner


A friend of mine has a 3D printer and we have discussed my scanner several times. He is going to send me an object he recently printed and I am going to attempt and we will replicated the piece. Also he is going to print me a piece for the stepper motor to glue my rotating deck on. I'll take a picture of the piece when its done. Here is an image of the Buddha statue he replicated.

BeagleBone Black!!!!

I purchased a BeagleBone Black and I am very excited it will be arriving tomorrow. I have a Raspberry Pi which all I ever do is SSH into it. I was a little disappointed at first with the Raspberry Pi but it has grown on me. Analog is a feature I with it had, otherwise you tend to just turn on LED's all the time, I do have a A-->D converter I just have not played with it yet. I am excited for the BeagleBone as I think it is a more "mature" device than a learning device, plus its a power house.

Monday, April 22, 2013

3D Scanner Theory

Theory

This entry I will cover some of the theory behind the laser. The first image is the concept on capturing the image with the webcam.
The webcam and the laser will have a fixed angle between them. The webcam will capture a 2D image with laser outlining the profile of the object. The picture will have captured the distance from the center of the image to the laser which is defined as 'B'. Knowing the angle between the webcam and laser and measuring the distance B from the captured image, the 'R' can be calculated from trig using sin(Beta)=B/R. This distance B and R is captured for each image taken, for mine its 200 images. The larger the angle between the webcam and the laser, the less error you will get with the depth. Taking a 2D image will profile the image in a perpendicular plane. The smaller the distance between the perpendicular plane and the laser, the less error you will have from te depth of the object being captured in a 2D image.

After the 'R' value is determined, this has to calculated to the X,Y and Z coordinates. The picture below explains.
'R' is a distance defined in the X-Y plane, shown my the large red dot. The red plane is where the line laser acts. If we know 'R' we can again use trig to calculate its location in the X-Y plane. The Z coordinates simply goes by the height of the object. To convert to Cartesian coordinates, the following equations are:
x = ro * cosinus( fi )
y = ro * sinus( fi )
z = z

Code

All my calculations come from how python stores the images. The JPEG's store R,G,B values so my program looks for the brightest Red value because I have a red laser. The pixel location is easy is is stored in a 2-D matrix starting with pixel location 0,0 and ending, for a 620x480 image at 620,480. I chose to look for the brightest red pixel so its ok to scan with some ambient light and it does not have to be done in the dark. My code is in the link below.