3
$\begingroup$

First off, I am not sure if this is the correct stackexchange site to ask this question on, so moderators can feel free to move it.

I am working on an application that identifies an object in an image. For example, let's say that the object is an apple, and the apple can be green, red, or both.

My plan is to create an array the same size as the image, then scan through the image, pixel by pixel, and if the current pixel is within my range of colors (green-ish or red-ish), add a 1 to the corresponding location in the array, else add a 0.

After this scan through the array, I will have an array of 1s and 0s, which will hopefully contain a concentration of 1s, representing the apple.


I am a computer science student, but have yet to take an AI class. So my question is: is this a good way to go about doing this? Or are there more established AI methods (or algorithms) for identifying objects in an image based on color?

EDIT: I should clarify that the problem isn't identifying if the image contains an apple, the problem is identifying where the apple is in the image.

asked Apr 22, 2013 at 15:04
$\endgroup$
3
  • $\begingroup$ If you will convert your image into HSV space, it would be more easy to classify objects based on their colors. $\endgroup$ Commented Apr 22, 2013 at 16:12
  • $\begingroup$ Do you think HSV would be better than HSL ? (I was planning on using HSL). $\endgroup$ Commented Apr 22, 2013 at 16:19
  • $\begingroup$ There's no much difference between them. $\endgroup$ Commented Apr 22, 2013 at 16:22

1 Answer 1

3
$\begingroup$

The general class for this problem is Template matching. The most common approach is performing a cross correlation of the template, in your example an apple, and an image which may contain the template.

A Google search for "template matching fast normalized cross correlation" will bring up some literature that should be helpful.

answered Apr 22, 2013 at 20:24
$\endgroup$
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.