views:

2432

answers:

9
+2  Q: 

Image Recognition

I'd like to do some work with the nitty-gritties of computer imaging. I'm looking for a way to read single pixels of data, analyze them programatically, and change them. What is the best language to use for this (Python, c++, Java...)? What is the best fileformat?

I don't want any super fancy software/APIs... I'm looking for the bare basics.

A: 

Short answer? I'd say C++, you have far more flexibility in manipulating raw chunks of memory than Python or Java.

warren_s
+4  A: 

if you need speed (you'll probably always want speed with image processing) you definitely have to work with raw pixel data. java has some real disadvantages as you cannot access memory directly which makes pixel access quite slow compared tto accessing the memory directly. C++ is definitely the language of choice for production use image processing. but you can e.g. also use c# as it allows for unsafe code in specific areas.( take a look at the scan0 pointer property of the bitmapdata class). i've used c# successfully for image processing applications and they are definitely much faste than their java counterparts. i would not use any scripting language or java for such a purpose.

Joachim Kerschbaumer
+2  A: 

Not only will C/C++ be faster, but most of the image processing sample code you find out there will be in C as well, so it will be easier to incorporate things you find.

Lou Franco
A: 

(This might not apply for the OP who only wanted the bare basics -- but now that the speed issue was brought up, I do need to write this, just for the record.)

If you really need speed, it's better to forget about working on the pixel-by-pixel level, and rather see whether the operations that you need to perform could be vectorized. For example, for your C/C++ code you could use the excellent Intel IPP library (no, I don't work for Intel).

Pukku
+1  A: 

if you are looking to numerical work on your images (think matrix) and you into Python check out http://www.scipy.org/PyLab - this is basically the ability to do matlab in python, buddy of mine swears by it.

jottos
+2  A: 

It's very east to manipulate the large multi-dimensional or complex arrays of pixel information that are pictures using high-level languages such as Python. There's a library called PIL (the Python Imaging Library) that is quite useful and will let you do general filters and transformations (change the brightness, soften, desaturate, crop, etc) as well as manipulate the raw pixel data.

It is the easiest and simplest image library I've used to date and can be extended to do whatever it is you're interested in (edge detection in very little code, for example).

Sean
+1  A: 

It depends a little on what you're trying to do.

If runtime speed is your issue then c++ is the best way to go.

If speed of development is an issue, though, I would suggest looking at java. You said that you wanted low level manipulation of pixels, which java will do for you. But the other thing that might be an issue is the handling of the various file formats. Java does have some very nice APIs to deal with the reading and writing of various image formats to file (in particular the java2d library. You choose to ignore the higher levels of the API)

If you do go for the c++ option (or python come to think of it) I would again suggest the use of a library to get you over the startup issues of reading and writing files. I've previously had success with libgd

Andrew Edgecombe
+1  A: 

What language do you know the best? To me, this is the real question. If you're going to spend months and months learning one particular language, then there's no real advantage in using Python or Java just for their (to be proven) development speed. I'm particularly proficient in C++ and I think that for this particular task I can be as speedy as a Java programmer, for example. With the aid of some good library (OpenCV comes to mind) you can create anything you need in a matter of a couple of lines of C++ code, really.

A: 

Short answer: C++ and OpenCV

Rafael Vega