Author Topic: Image Processing Library for python  (Read 4154 times)

0 Members and 1 Guest are viewing this topic.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Image Processing Library for python
« on: April 02, 2009, 08:36:51 AM »
I want to make something like this http://www.pages.drexel.edu/~twd25/webcam_laser_ranger.html except I want to right the code in Python. Does anyone know of some libraries that will make this easy for me?  ;D
Robots are awesome!

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: Image Processing Library for python
« Reply #1 on: April 03, 2009, 02:38:56 AM »
i did this a few years ago.
there is a python library for accessing a jpeg as an array.
i'm afraid i can't remember what it's called though.

while the python version worked i ended up rewriting it in C for better performance.


dunk.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: Image Processing Library for python
« Reply #2 on: April 03, 2009, 07:51:31 AM »
I was looking over the Handbook for PIL (Python Imaging Library) again and I found this:
Quote
getdata
im.getdata() => sequence

Returns the contents of an image as a sequence object containing pixel values. The sequence object is flattened, so that values for line one follow directly after the values of line zero, and so on.

Note that the sequence object returned by this method is an internal PIL data type, which only supports certain sequence operations, including iteration and basic sequence access. To convert it to an ordinary sequence (e.g. for printing), use list(im.getdata()).
Methinks I could use this?
Robots are awesome!

Offline robomow

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: Image Processing Library for python
« Reply #3 on: April 13, 2009, 11:18:59 PM »
I am working on this. since it is not a priority for our robot mowers yet. It is progressing slowly.

Would love to work with you on this.

I have a gui and the video webcam working and can capture single frames for real time processing. I have done some processing pixel by pixel and with PIL filters which must be written in C++ because they are 100 times faster.

I have some code that detects golf course bunkers and will be detecting faairway, greens, cart paths, rough, tree lines etc. from both aerial and close up images. Evetnually, I will also be making a low cost laser vision system using pulsed scanning lasers. I have a pen light lasers $3, a $30 dual laser disco laser device and several scrap construction laser units to play with. I have been also been experimenting with Cad Sulfide and other photdetectors.


links - http://videocapture.sourceforge.net/   
 http://sourceforge.net/projects/camwrapper
http://iphome.hhi.de/fechteler/papers/icip2007b_FechtelerEisertRurainsky.pdf

http://www.engr.uky.edu/~lgh/3dDA/hb2003.htm this is old stuff check his web site for latest versions

http://fab.cba.mit.edu/classes/MIT/863.07/11.05/3Dscanner/code/fabscan.html - I couldn't get the pyton VTK wrapper to work from this code but i did get vtk workign from other python applications.

Please let me know if you'd like to collaborate on this. I have several needs from this system. 1) machine vision. 2) animation mesh vertice generator and 3) CNC parts duplicator.




Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: Image Processing Library for python
« Reply #4 on: April 14, 2009, 08:28:48 AM »
I finished writing the code for grabbing an image from the webcam and telling where the brightest pixel is. I realise that C or C++ would have been a better choice for this project, but I wanted a chance to get more familiar with Python, and for me the code runs plenty fast in Python anyways. So now all I have to do is calibrate the sensor and do some math and I'll be done!
Robots are awesome!

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: Image Processing Library for python
« Reply #5 on: April 21, 2009, 08:05:53 AM »
I need some help with the math part of things, so far I've been using this as a guide http://www.pages.drexel.edu/~twd25/webcam_laser_ranger.html I don't get where he gets the numbers for the "Radian offset" and "Radians per pixel pitch"?
Robots are awesome!

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: Image Processing Library for python
« Reply #6 on: April 24, 2009, 01:28:46 PM »
~BUMP~
Robots are awesome!

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Image Processing Library for python
« Reply #7 on: April 24, 2009, 01:32:41 PM »
MY QUESTION IS...why do u need an image processing library for python if u already have so many options available in the form of java,opencv,matlab,roborealm..?????????????????????
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: Image Processing Library for python
« Reply #8 on: April 24, 2009, 01:41:46 PM »
I already have the image processing part figured out. I need help with the radian stuff but don't want to start a new thread.
« Last Edit: April 24, 2009, 01:44:23 PM by Trumpkin »
Robots are awesome!

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Image Processing Library for python
« Reply #9 on: April 25, 2009, 12:30:47 AM »
oh...radian ..???
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: Image Processing Library for python
« Reply #10 on: April 25, 2009, 04:51:34 AM »
i worked out the maths from scratch when i did it.
it's not *too* hard. just basic trigonometry.

but my method ended up with a multiplier as well. (Radians per pixel pitch on the link.)
this value is dependent on the camera.

the easiest way to work it out is by experimentation.
set up your vision system with arbitrary values for these variables, take some readings at set ranges.
from this you will be able to work out what value you get at zero range. use this value to set your "Radian offset".

next work out the multiplier you need to turn your values into accurate distances. this value can be used to work out your "Radians per pixel pitch".


Quote
I finished writing the code for grabbing an image from the webcam and telling where the brightest pixel is.
far better than looking for the brightest pixel is to compare 2 images, one with the laser on, the other with the laser off.
this way you will always be able to find the laser spot, even if the laser is not the brightest thing in the image.

you can see my system in action on the last few pictures of this page: http://mrdunk.googlepages.com/sensors


good luck!

dunk.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: Image Processing Library for python
« Reply #11 on: April 25, 2009, 11:28:38 AM »
So I just guess the values?
Robots are awesome!

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: Image Processing Library for python
« Reply #12 on: April 25, 2009, 04:40:52 PM »
So I just guess the values?
to start with yes.
then you can calculate how much your guesses are out by and calibrate accordingly.

dunk.

 


data_list