开发者

How can I go about extracting the background from an image?

Basically, suppose that I have a fingerprint. I know the dimension of my image, and I know that the fingerprint is black on a white background or that it is green on a black background or something like that.

Is there a way to process only the parts that delimit the image, in this case, the fingerprint? What I'm trying to do is basically this:

1) Delimit fingerprint

2) Extract the important points to compare to other fingerprints

3) Find best match on a database of other fingerprints that had their 开发者_StackOverflow中文版points previously extracted

I already have methods for 2 and 3, so now I just would have to delimit the image.

Programming language would have to be Ruby, Java or C++. Ruby preferred, then Java, and God help me if I have to use C++. I don't have any experience with image processing, but I'd like to do this with multiple common formats such as jpg, gif, png, if possible.


I think that the best way to do it is applying a edge detection filter to your image.

There are may approaches as suggested by wikipedia (article), but noone of them is trivial because they work on gradients or kernels. You should check Canny Edge Detection that should be enough straight-forward to implement: tutorial.

In any case if you want to avoid going deep into implementation details you should use OpenCV that is a computer vision library able to do these things in a simple way. You can use it for sure in C++ and Java but I think that a wrapper for Ruby is offered too. This is a simple example using that library with Canny algorithm.

EDIT: actually my answer covers point 2-3, so I'm wondering what you mean by delimiting the image? Think about the fact that scaling or rotating must be considered too if you want to compare different fingerprints: you need a fuzzy comparator.. maybe you should work on the Fast Fouried Transform version of the image that can handle such things in a better way.


An easy approach could be using threshold, like:

Convert your image to grayscale - so you have fingerprint in white on black.

Find a threshold value that gets most of the fingerprint.

Use open operation (http://en.wikipedia.org/wiki/Mathematical_morphology) to remove noise. (experiment with dilate a few times)

Find the center of gravity (x,y) of the image and the standard deviation (vx, vy).

In the box:

[x-2vx,y-2vy], [x-2vx,y+2vy], [x+2vx,y+2vy], [x+2vx,y-2vy]

You will find 95.4% of the pixels You could narrow the box down to find the actual max and min pixels in it, if you have many outliers. Use the box to clip from the original image.

It is simple method that might work well for your situation :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜