Computer Vision And Image: Implementing Harris Operator Using Opencv

The main objective of this mission is to create a Harris operator using OpenCV. This report contains the Harris operator without using the internal functions of OpenCV. Detailed explanations are given for the procedure with images. The Harris operator can be used to detect corners and is widely used in image processing. The mission was under the image processing module and basic knowledge about the Harris operator was provided with sample images. The whole procedure of implementation has been explained using a single image, and at the end of the report, the discussion and conclusion have been included in detail with respect to the simulations that were carried out to some selected images. Finally, the appendix is included with simulations that were carried out for several images, which was captured by myself.

Introduction

Corner detection in images plays an important role in computer vision applications. A corner can be defined as the joining of two edges. Angle detection is commonly used in image matching, motion detection, pattern recognition, video tracking, image mosaic, panoramic sewing, 3D modeling, and object detection.

The sudden intensity changes characteristic of all directions of a given image is considered by the corner detection algorithms. There are a number of different approaches to corner detection using different types of corner detection algorithms. Operators Harris, Beaudet, Moravec, Forstner and Curvature Scale Space (CSS) are some of these corner detection algorithms. Among them, the Harris operator is one of the well-known algorithms widely used in applications.

Corner detection is widely used in current image processing applications. There are many methods for detecting angles. One of them is the Harris operator. Harris operator is a mathematical operator. It can be used to search for features in an image. The Harris operator is easy to use and can be used with all types of computers. Processing power is lower than other improved methods

Most corner detection algorithms use the characteristics of sudden intensity changes in a portion of a given grayscale image. Here, gray scale is used because the manipulation is comfortable due to the intensity variation from black (0) to white (255).

Methodology

Basically, Harris Corner Detector has seven development stages as follow.

  1. Convert the selected color image to grayscale to improve processing speed.
  2. Calculate the gradient of the image in the x and y directions separately using the Sobel operators.
  3. Calculate the second moment of the image in the x and y directions at each pixel, including the cross-correlation between the first moment of the image in the x and y directions.
  4. Conjugate the computed matrices of the second moment in the third step with a windowing function.
  5. Calculate the Harris matrix with the sums of derivatives products at each pixel.
  6. Calculate the response of the detector to each pixel using the Harris criterion.
  7. Extracting points in the image having a larger corner response in a window neighborhood. These dots represent the corners of the original image.

Theory

Harris Corner Detector is an angle extraction operator widely used in image processing and computer vision algorithms. It was introduced by Chris Harris and Mike Stephens in 1988. It is also an improved version of the Moravec corner detector.

The mathematical model calculates the matrix of the second moment, the function of wedge and the eigenvalues of the matrix of the second moment. If the calculated eigenvalues are large and almost equal at this point, the mathematical modeling considers this point as a corner point.

The Harris Corner Detector Algorithm is a robust, informative mathematical model invariant to translation, rotation, and illumination change. However, this is not invariant for large scale changes. The Harris operator is included on the basis of Moravec operator. by computing the auto-correlation matrix and the gray value change to get the corners.

Supposed f (x, y) is gray value of pixel (x, y) after moving (u, v) the gray intensity change can be expressed by the following formula. By Taylor formula Into the formula (1), to Where That is the auto-correlation matrix of pixel (x, y) Harris corner response function is: Here k is an empirically determined constant; k = 0. 04 - 0. 06. If λ1 and λ2 represent the eigenvalues of the Harris M matrix, the values of these eigenvalues can be used to determine whether the region is a corner, a flat or an edge. When | R | is small - λ1 and λ2 are small and the result is a flat region. When R > λ2 and the region is an edge Figure

Result

Here according to the scope of the project 3 different pictures were captured by myself. One of them is shown here to identify the methods and scopes are used. In order to implement the Harris Angle Detector algorithm, an image of a restaurant table and a wall has been used in the programming environment, as the intersections of the bus bars can be easily identified as the angles.

The convolution was performed with derivatives products obtained in the previous step with a windowing function. Here too, for the convenience of programming, internal pixels have been neglected. In this step, as a window function, a Gaussian kernel of 5 out of 5 was used to filter derivative products. Gaussian kernel values were obtained using a mean Gaussian zero distribution with a standard deviation of 1. 5. Using the Harris criterion mentioned above in the theoretical part, the response R of the detector to each pixel was obtained. Here, for the value k, 0. 05 was used because it satisfies the range mentioned above. Points with a larger corner response in a window neighborhood have been identified using the threshold of R, greater than 0. These points represent the corners of the original image and have been marked using of a circle. To draw a circle, the circle function has been used. The red circles in the original image represent the locations of the corners.

Discussion

As previously mentioned, in the original image, it is clearly visible that most of the corners of the above image have been detected using the implemented Harris corner detector. According to the image above, the algorithm detected the corners at the intersection points of busbars larger and larger. On top of that, it was able to detect the corners of the inter-clamp.

Here we can compare the wedge detection capability of the Harris wedge detector that has been implemented by ourselves with the Harris operator built into OpenCV. For this purpose, the same image was used, and the Harris Corner Detector was implemented using OpenCV integrated libraries. The image below shows the corners detected using the Harris operator function in OpenCV.

However, simulations have shown that the integrated Harris corner detector is somewhat sensitive to smaller busbar intersections than the Harris operator set up by us. The main reason for this slight difference in performance is the response of the operator.

In the implemented Harris angle detector, the detector response depends on the windowing function, which is a Gaussian 5 x 5 kernel in this scenario. However, for different sizes of Gaussian nuclei, the response of the detector varies. For an example, we can use a rectangular windowing function that gives equal weights for the pixels underneath.

Conclusion

In this assignment, discuss the Harris operator without built-in functions. To change the threshold values, we are able to take precise angles in an image. Changing the threshold value is harder to compare with images. Sometimes it can be high values and sometimes low values. But by taking an appropriate threshold value, we can get a better picture with the detected corners. Most of the time, the operator did not work properly for complex images. For this type of situation, there are complex detectors such as the Susan detector. By using this type of enhanced detectors, we can get a better image detected at an angle.

15 April 2020
close
Your Email

By clicking “Send”, you agree to our Terms of service and  Privacy statement. We will occasionally send you account related emails.

close thanks-icon
Thanks!

Your essay sample has been sent.

Order now
exit-popup-close
exit-popup-image
Still can’t find what you need?

Order custom paper and save your time
for priority classes!

Order paper now