Single color detection using OpenCV

Live and Laugh

After a few days of learning OpenCV, I started to write my first OpenCV program, the requirement is to detect single color and find three largest color objects, it’s a very basic program, but you can know a lot about computer vision if you understand the code. OpenCV provide so many functions, you have to know what you want and what the function does.

This program still run on the Raspberry Pi, frame per second is about 8.5, if you want to find more or less than 3 biggest objects, you can change N. Here is code(You also can get it in my Github) sg_color.c:

Here is makefile:

LIBS= `pkg-config --libs opencv`
CFLAGS= `pkg-config --cflags opencv`
objects= sg_color.o

sg_color: $(objects) 
	gcc $(LIBS)$(CFLAGS) -o sg_color $(objects)

.PHONY: clean
clean:
	rm sg_color $(objects)

Here is processed frame and threshold image:
frame

Threshold

View original post

Advertisements

About Khuram Ali

Programming... Programming and Programming...!!!

Posted on October 18, 2014, in Computer Vision and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: