HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Identifying an object in an image based on color (AI ?)

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
imagecolorbasedobjectidentifying

Problem

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.

Solution

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.

Context

StackExchange Computer Science Q#11489, answer score: 3

Revisions (0)

No revisions yet.