File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Image filtering (and other crazy stuff) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Image filtering (and other crazy stuff)" Watch "Image filtering (and other crazy stuff)" New topic

Image filtering (and other crazy stuff)

Kaif Ahmed

Joined: Aug 22, 2005
Posts: 7
This is probably a little bit advanced for the beginner boards, but I am a beginner who's been dragged kicking and screaming into Java (but I secretly like it).

Anyway, I'm trying to code a face detection program for my final year prject at University. The program needs to take a colour image of a scene and show where it thinks a human face is (yeah, I know).

After a bit of research I think I know what I need to do to make this all happen, I just need to know how to do it in Java.

First step is I need to do is take the colour image and filter it so that the image is transformed to show only skin colour regions. The image below shows the normal image (a) and the image after filtering (b). (The images have been taken from a paper that I'm using as a reference by K. Sobottka and I. Pitas from the University of Thessaloniki)

I was just wondering what API should I be looking into to do this? I've had a look through the 2D image API, but there's so much to it! Any ideas?

Second step is a little more complicated, not sure if a single API could do it, but let's give it a shot.

I then need to take this freshly filtered image and perform "connected component analysis" on it. That means that the image is filtered so that it only shows the location of the skin colour portions of the image. The result is the image that just shows areas where skin colour is present (it'll probably be a black and white image). So our filtered image shoul look like the one in (c).

Again, I'd just like some ideas as to which API's or publically available classes are out there to help me do this.

As for the final part, where a pattern recognition algoritm decides what portions of (c) could be a face (shown in (d)), well... I haven't actually thought about that yet (my supervisor would kill me if he knew how behind I was).

The main thing at the moment is to make a program that'll take an image, filter out the skin colour elements, then perform connected component analysis on it. That should get him off my back for a while at least

Thanks in advance for the help.

(by the way, I know this is probably the crudest form of face dection, but time is pretty short, I need to demo something in a months time! Arrrggh!)

Thanks to ImageShack for Free Image Hosting
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
It seems you are looking for an API that will solve most of the problem for you, and I really don't think that is going to happen. You might find the Graphics2D API useful when you get deeper into your project but it seems to me you need to break the problem down and define it more accurately: so you want to find all skin regions, right? What constitutes a skin region? How is such a region defined? How do you tell the difference between a person and a background that has a similar colour to that person's skin? This ignores other issues of varying skin colours, lighting, etc.

When you can answer those questions and come up with some possible solutions, you will find the question of choosing the right API much easier
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
You are in direct violation of rule 1 of the beginners board.
BEWARE: Persons caught posting questions of any difficulty in this forum are subject to fines of up to 10 post responses. Only responses that make SENSE will be counted towards the remittance of said fine.

I don't make the rules, I just arbitrarilly point them out.

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15093

Have a look at the Java Advanced Imaging API.

(I haven't used this myself, but I think it may contain things that you're looking for).

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: Image filtering (and other crazy stuff)
It's not a secret anymore!