0

I used the Scharr filter and I have the x and y gradients from here. May I know how I can plot the orientation map from here? Here's the picture of my Scharr filter result. It's a fingerprint image.

And this is the code i used.

Mat src,grad;
Mat grad_x,grad_y;
Mat abs_grad_x,abs_grad_y;

int scale=1;
int delta=0;
int ddepth=CV_16S;
int c;
src=cv::imread("remove_noise.bmp",CV_LOAD_IMAGE_UNCHANGED);

Scharr(src,grad_x,ddepth,1,0,scale,delta,BORDER_DEFAULT);
convertScaleAbs(grad_x,abs_grad_x);
Scharr( src, grad_y, ddepth, 0, 1, scale, delta, BORDER_DEFAULT );
convertScaleAbs(grad_y,abs_grad_y);

addWeighted(abs_grad_x,0.5,abs_grad_y,0.5,0,grad);
cv::imwrite("SobelScharr.bmp",grad);
BConic
  • 8,750
  • 2
  • 29
  • 55
user3396218
  • 255
  • 2
  • 8
  • 20
  • You want to plot the orientation map for visualization ? – BConic Mar 27 '14 at 13:29
  • @AldurDisciple, i wish to plot to determine a certain feature (core) of the fingerprint. Here is the result I am hoping to have. http://i.imgur.com/NZm1cth.png – user3396218 Mar 27 '14 at 13:57

1 Answers1

1

I have implemented ridge orientation few months back using matlab..i have used velocity plot for plotting ridges..i don't have knowledge on opencv..I assume this might help you..here is my code..

% Orientation vectors
        vec_u = len/2*cos(p_theta);
        vec_u = filter2(smooth,vec_u);
        vec_v = len/2*sin(p_theta);
        vec_v = filter2(smooth,vec_v);

        quiver(x,y,vec_u,vec_v,0,'.','linewidth',1.2, 'color','k');
    %     imshow('FillValues',255);
       axis equal,axis ij,axis off; hold off;

This might also help you..

www.mathworks.com/help/matlab/ref/quiver.html‎

Ritesh
  • 256
  • 2
  • 13