MATLAB Practice Program (Moravec operator)

Source: Internet
Author: User

This operator is the image in the history of the first feature point extraction algorithm, proposed in 1977, very simple, take practiced hand very suitable.

The algorithm works as follows:

1. Select a reasonable neighborhood traversal image, here is the 5*5 neighborhood. In the neighborhood, the square sum of the difference between vertical, horizontal, diagonal and four neighboring pixels of the opposing angle is computed in order, as the neighborhood eigenvalue.

This is roughly the way it looks:

Formula:

Here k is the radius of the window.

2. Select the minimum value from the four eigenvalues as the first candidate eigenvalue for the pixel.

Formula:

3. Set a threshold value that is greater than the first candidate eigenvalue of the threshold to select two candidate eigenvalue values.

4. Set a neighborhood to use the largest two candidate eigenvalues of the neighborhood as the final feature value to select.

Original:

After processing:

The MATLAB code is as follows:

Clear All;close all;clcimg=double (Imread ('lena.jpg')); [H W]=size (IMG); imshow (img,[]) IMGN=zeros (h,w); n=4; fory=1+n:h-N forx=1+n:w-N Sq=img (y-n:y+n,x-n:x+N); V=zeros (1,4);  forI=2:2*n+1%vertical, horizontal, diagonal, square and V of gray difference in four directions of opposing angles (1) =v (1) + (sq (i,n+1)-sq (i-1,n+1)) ^2; V (2) =v (2) + (sq (n+1,i)-sq (n+1,i-1)) ^2; V (3) =v (3) + (sq (i,i)-sq (i-1,i-1)) ^2; V (4) =v (4) + (Sq (i, (2*n+1)-(i-1))-sq (I-1, (2*n+1)-(i-2)) ^2; End Pix=min (V); %Minimum Value IMGN (y,x) in four directions=pix; Endendt=mean (IMGN (:)); %set a threshold value less than 0 IND=find (imgn<T); IMGN (Ind)=0; forY=1+n:h-n%Select Local maximum and not 0 values as feature points forx=1+n:w-N Sq=IMGN (y-n:y+n,x-n:x+N); ifMax (sq (:)) ==imgn (y,x) && IMGN (y,x) ~=0 img (y,x)=255; End Endendfigure;imshow (img,[]);

The whole process of the algorithm is very simple, practice, by the way this feature value mountain algorithm.

MATLAB Practice Program (Moravec operator)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.