![]() |
finding angle of line in data (Biometrics)
Hello again :)
I'm almost finished with my program to fingerprint recognition. Now i'm struggling with matching. All I need is coordinates of minutiae and its angle, like on image below http://i54.tinypic.com/2wqzvb7.png I don't have idea how to get this angle. Well, I think to make straight line from from last two or three pixels but i'm not sure if this is correct way to do this. |
Quote:
Quote:
|
Quote:
Quote:
|
Quote:
|
Looking at your picture examples as well, it's obvious that using the "last two or three pixels" will not be accurate either.
In the left pic, the line (and angle) seems to be derived from the end-centers of the gray bar in question. In the right one, they seemed to split the difference between the ends of the "Y" to formulate a center point and drew the line from there. I'd want to verify the method being used here before doing anything. |
Quote:
Quote:
|
Can someone show me an easy (or any) way to calculate gradient? I know how to calculate gradient of function but calculate gradient of an image at [x,y] is a mystery.
|
1) Define exactly what you mean by "calculate gradient of an image at [x,y]". Write down a concise definition in words.
2) Google for what you wrote in step 1. |
Quote:
Unless this is a programming exercise you will probably save a substantial amount of time by licensing a module from a biometrics company, that way your part is limited to sending the image to the module and processing the true/false return. |
First - finding a minutiae (i.e. bifurcation) is not that big deal. Let's say I already have minutiaes coordinations in array.
By calculate gradient at (x,y) i meant: The gradient grad(x,y) at point [x,y] of an image is a 2 dimensional vector [grad_x(x,y), grad_y(x,y)] where grad_x, grad_y are derivatives of an image at (x,y). That what I want to achieve. It's for ridge orientation. So i think if I will get the ridge orientation I will be able to get the minutiae orientation. Quote:
It will be good to add LaTeX to forum ;) |
Quote:
(Once you define these things in terms of the data you have, you will be able to figure out how to do it. Derivatives are things that act on functions. Functions act on numbers. What are the functions? What are the numbers? Don't tell me - tell yourself.) |
ok I figured out that i will get grad_x and grad_y from Sobel mask/operator. Simply saying Sobel mask is for edge detection. It's 3x3 mask applied on each pixel. Seems easy but... my code doesn't work
Code:
NSBitmapImageRep *bitmapImageRep = [[NSBitmapImageRep alloc] initWithData:[loadedImage TIFFRepresentation]];Code:
// Gradient XCode:
pixels[(row*width + col)] = abs( (pixels[((row+1)*width + (col-1))] + 2*pixels[((row+1)*width + col)] + pixels[((row+1)*width + (col+1))]) - (pixels[((row-1)*width + (col-1))] + 2*pixels[((row-1)*width + col)] + pixels[((row+1)*width + (col+1))] ));http://img821.imageshack.us/img821/7...sedlena.th.png |
Well, either your pixels calculation is incorrect or you aren't displaying the pixels correctly.
At a cursory glance at your code, I don't see you using the 'pixels' array after it has been filled in. |
I don't know where but the calculations are wrong somewhere. 'pixels' array is used here:
Code:
bitmap2 = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: &pixelsI'm curious where i have a mistake. The second method, is simple. I remember that the zero point (0,0) of the image is in top left corner. But still it doesn't make any sense to me why this code doesn't work... |
Quote:
|
No. It works. If you paint half an image with black or white color it works. Even if this image i posted you can see that it paints something, but it's not what i'm looking for. It's more white noise but you can see the shape of Lena.
But just for curiosity - i will check it EDIT: This code is working as it is. But definitely there is a mistake that I cannot see. But as I said - i receive white noise with shape of Lena... |
Slowly forward. I added some simple code
Code:
if (SUM>255)Code:
SUM = abs(sumX) + abs(sumY);http://img35.imageshack.us/img35/575...517godz.th.png But still it's not properly done edge detection. |
I'd suggest debugging this with a very simple constructed image rather than Lena. Something where you can see what results you should get on a per-pixel basis. Something with as few pixels as possible - maybe a 4x6 image. Then step through the code and compare with your paper calculations until you find where it is going wrong.
|
Ok. The problem is trival. And I don't know why i didn't saw this mistake before.
Insted of using pixels(row*width + col) here: Code:
pixels[(row*width + col)] = 255 - SUM;Code:
helpeArray[(row*width + col)] = 255 - SUM;http://img10.imageshack.us/img10/526...518godz.th.png |
Quote:
Looks like your latest routine is not picking up vertical edges. None of the detail above and to Lena's left is being picked up for example. EDIT(Actually implies there's something wrong with your dx calculation) Implies there's at least one problem in your code dealing with dy. Are you sure your y Sobel mask is the right way up? Cocoa uses a bottom left origin not a top left origin as in some graphic systems. Also don't see why simply copying an array improves your result. Would seem that something else is actually going on. |
Quote:
And yes I think this code is correct right now. This convolution is correct. And if you copy my code to your program and you will add this 2 loops instead of Sobel algorithm: Code:
for(row=0; row<height/2; row++) {Quote:
But OK, now i see that i took wrong image ;) I should use this one: http://img687.imageshack.us/img687/5...110518godz.png If you have other insights please feel free to write. :) As anyone else :) And sorry for my bad english :) |
Not sure, but isn't there an edge detection routine in the Cocoa frameworks somewhere? I know it's one of the things that QuickTime can do.
|
Well, to be honest, I haven't heard about it. But even if there is a class for edge detection, I'm glad to write my own program just to practice. I'm new in image processing and this seems to be great exercise :)
|
| All times are GMT -5. The time now is 06:21 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.