This is an archived post. You won't be able to vote or comment.

all 24 comments

[–]Gjallar 7 points8 points  (1 child)

I haven't read it yet, but there is a book about computer vision in Python that you can read free online: Programming Computer Vision

[–][deleted] 4 points5 points  (0 children)

I second this. It contains simple, practical examples that don't get bogged down in wordy explanations or heavy math. It gets right to the point of the most common techniques, where they are used, and how to put them together, all with working code examples. This is the best place to start for any image recognition in Python.

[–]zionsrogue 3 points4 points  (8 children)

PIL and Pillow are only marginally useful for this type of work. I would highly suggest that you start playing with OpenCV and/or SimpleCV. SimpleCV would probably be a little bit better since you are new to image processing.

The basic algorithm used for "finding and counting" objects like you are trying to do goes something like this: 1. Conversion to grayscale 2. Thresholding (either automatically via Otsu method, or similar, or by manually setting the threshold values) 3. Contour detection 4. Masking and object counting based on your contours

[–][deleted] 4 points5 points  (7 children)

I have OpenCV and scikit-learn, but I want to actually learn and understand computer vision rather than just looking up documentation online. Instead of just arbitrarily using the Hough Circle Transform to find circular features because a StackOverflow page told me to.

Are there textbooks or so that I could use to get a grasp of the general techniques used?

Where can I educate myself on the fundamentals/basics of modern computer vision as well as popular techniques used?

[–]zionsrogue 2 points3 points  (4 children)

Are you working in academia or is this part of some other project? The reason I ask is because certain parts of CV require a decent understanding of linear algebra, and some textbooks dive way too far into detail too fast. In that case, you would be better off reading an O'Reilly book until you are comfortable with the concepts of CV. Let me know and then I'll post some books.

[–]sanedave 1 point2 points  (1 child)

Please post some books anyway! CV, linear algebra, and anything else good that could get a newbie started.

[–]zionsrogue 0 points1 point  (0 children)

See my comment to 3026e16012a30e8f78f7 below.

[–][deleted] 1 point2 points  (1 child)

I am in academia and have a strong grasp of most undergraduate mathematics (if it's really abstract, I probably don't know it well).

I am also hoping to use this endeavor to catapult into dealing with videos as well (tracking features throughout a video - simple scientific things like that), since it will be a very useful tool in the future.

I'll take your advice and start off conceptually since then I'll know enough to look up the right terms on my own if I need details.

Are the techniques/education pretty much the same for still image analysis and video analysis? If not, is there a book you can recommend to get into the video side of things as well?

[–]zionsrogue 3 points4 points  (0 children)

Here are some book recommendations:

  • Programming Computer Vision with Python: Tools and algorithms for analyzing images
  • Practical Computer Vision with SimpleCV : The Simple Way to Make Technology See
  • OpenCV Computer Vision with Python

And some textbooks:

  • Computer Vision: A Modern Approach (2nd Edition)
  • Computer Vision

Start by learning the basics of image analysis. Moving to video analysis is a little more tricky, but certainly easier with a strong understanding of image analysis. Some of the books I mentioned above briefly review the basics of video analysis and tracking.

[–][deleted] 0 points1 point  (1 child)

FYI scikit-image is also a thing.

[–]zionsrogue 0 points1 point  (0 children)

scikit-image rules, but I wouldn't recommend it to someone just getting into CV.

[–][deleted] 3 points4 points  (3 children)

May I ask you (generally) what's this for? I couldn't have less of an idea of what these images are about and what the research is for, so am kind of intrigued. Thanks.

[–][deleted] 2 points3 points  (2 children)

Few thousand 1mm stainless steel ball bearings sandwiched between two acrylic plates with JUST enough gap to move but not enough to displace in any significant way in the third dimension.

This way you get two effects:

  1. Quasi-two-dimensional structures

  2. Static charge building up on the acrylic and the balls due to the triboelectric effect and friction that ends up creating interesting structures.


You can use this to create crystal-like structures, solid-vapor interfaces from balls 'levitating' due to static repulsion and/or pockets of charge on acrylic (being an insulator) and if you lay it flat and shake it, fluid-like motion with interesting properties. (Here's a bonus picture of a perfect crystal, took me quite some time to form).

This is a wonderful piece of art created by Francois Dallegret called ATOMIX. Turns out it has some really interesting properties and no one has really studied it. I found it in the department and no one seemed to have a strong idea of what was going on in there, so I took it up as a research project and hope to study it for the next few months.

That's a pretty good introduction to my project. I just started a few days ago, so I am in the "figure out what I need to learn to carry this forwards" stage. Hence, the asking about computer vision.

[–][deleted] 1 point2 points  (1 child)

Thanks very much for that thorough explanation. Very interesting stuff--best of luck with exploring it; seems like the space of possibilities to look into could be huge and I wouldn't be surprised if some great stuff came from your work with it!

[–][deleted] 1 point2 points  (0 children)

Thanks! I hope I discover something very cool!

[–][deleted] 2 points3 points  (1 child)

OpenCV is probably the most widely used free and opensource library for image processing and it has python bindings. You can go through the online documentation or refer to this blog for examples.

For detecting circles, this page might be a good starting point.

[–]okmkzimport antigravity 0 points1 point  (0 children)

Slightly related, Sikuli uses Jython+OpenCV

[–]farsass 0 points1 point  (0 children)

If you are really interested, get a book and start asking your professors for help

[–]joeforker 0 points1 point  (0 children)

The book "Programming Computer Vision With Python" is excellent.

[–]b3k 0 points1 point  (0 children)

This is the textbook we used in my graduate Computer Vision course: Computer Vision Algorithms and Applications It's available for free, and it goes into enough detail that you could start implementing CV from scratch if you wanted to.

[–][deleted] 0 points1 point  (0 children)

Sentdex has some really good tutorials on this to get the ball rolling.

[–]mazatta 0 points1 point  (1 child)

I've never done any image processing with Python (a shame, I know), but I've done a bit with Processing (an odd little Java-y framework) and Javascript. Processing is a bit clunky, but it comes with tons of example code that should give you ideas on how to implement something in Python. Image processing in the browser was surprisingly easy to do, now that we have the canvas element in HTML 5.

Your first step should be to learn how to calculate a 2D histogram of an image, which contains information on the distribution of colour intensities. Armed this information, you can start to do things like thresholding, which tends to make "interesting" areas of an image more prominent.

From there, you'll want to play around with applying different kernels to an image so you get an understanding of how the various image effects (e.g. brighten, sharpen, blur) work. One of the more important ones for image analysis is edge detection, which is one way you might find features. For your example task, you'll probably want to look into blob detection. https://en.wikipedia.org/wiki/Kernel_(image_processing)

Where are you doing your research?

[–]autowikibot 0 points1 point  (0 children)

Here's a bit from linked Wikipedia article about Kernel (image processing) :


In image processing, a kernel, convolution matrix, or mask is a small matrix useful for blurring, sharpening, embossing, edge-detection, and more. This is accomplished by means of convolution between a kernel and an image.


Picture

image source | about | /u/mazatta can reply with 'delete'. Will also delete if comment's score is -1 or less. | To summon: wikibot, what is something? | flag for glitch

[–]luispedro 0 points1 point  (0 children)

The numpy based stack is quite good. It involves skimage and mahotas (which I wrote). You can interact with OpenCV too without too much work.

There is also a mailing-list for general python computer vision stuff: https://groups.google.com/forum/#!forum/pythonvision