Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplaying the ridge orientation as a flow chart
    text
    copied!<p>I am trying to view my local ridge orientation of a fingerprint as a flowchart. But I seem to fail miserably at doing so. My method consists of the following steps:</p> <ul> <li>use the <code>lro</code> function</li> <li>find the most dominant angle in a 16x16 block</li> <li>create a line segment and rotate it by the dominant angle to display it</li> </ul> <p>The problem is that while the angles that the <code>lro</code> produces are good, the display of these in the flowchart does not work at all. There I just get a lot of random angles going in all kind of directions. Can anyone help me solve this problem?</p> <p>Here is the code I'm using: </p> <pre><code>def lro(im_np): eps = 2**(-52) orientsmoothsigma = 4 # original Gxx = cv2.Sobel(im_np, -1, 2, 0) Gxy = cv2.Sobel(im_np, -1, 1, 1) Gyy = cv2.Sobel(im_np, -1, 0, 2) Gxx = scipy.ndimage.filters.gaussian_filter(Gxx, orientsmoothsigma) Gxy = scipy.ndimage.filters.gaussian_filter(Gxy, orientsmoothsigma) Gyy = scipy.ndimage.filters.gaussian_filter(Gyy, orientsmoothsigma) angle = math.pi/2. + numpy.divide(numpy.arctan2(numpy.multiply(Gxy,2), numpy.subtract(Gxx,Gyy)),2) return angle def createLine(im_np): #Assumes it is 17x17 #Takes in the block-direction #returns a block-direction image as a numpy array angle = numpy.max(im_np) # print im_np.shape im = Image.new('L', (im_np.shape[0], im_np.shape[1]), (0)) draw = ImageDraw.Draw(im) draw.line([(0,im_np.shape[0]/2), (im_np.shape[0],im_np.shape[0]/2)], fill=255) im = im.rotate(angle) img_np2 = numpy.asarray(im) # print img_np2 return img_np2 def findDomAngle(im_np): mask = numpy.zeros((180,2)) for i in range(180): mask[i][0] = i+1 for i in range(im_np.shape[0]): for j in range(im_np.shape[0]): mask[im_np[i][j]-1][1] += 1 max = 0 bestdir = 0 for i in range(180): if mask[i][1] &gt; max: bestdir = i + 1 max = mask[i][1] # print mask # print max return bestdir def blkdir(angle_mat): x = angle_mat.shape[0] y = angle_mat.shape[1] # print angle_mat domAngle = findDomAngle(angle_mat) # print domAngle blkAngle = angle_mat blkAngle.setflags(write=True) for i in range(x): for j in range(y): blkAngle[i][j] = domAngle return blkAngle </code></pre> <p>I am applying another function to process the <code>image</code> block by block, but this method has proven to work so I don't find it relevant to include.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload