# Conversion_Corners

## Using of command

Command is use for find corners in the tested image.There are 3 functions for corners finding:

1. CornerHarris. Function calculates for each pixel 2x2 gradient covariation matrix M over a blockSize x blockSize. Than it stores to the destination image. Corners in the image can be found as the local maxima of the destination image.
2. CornerMinEigenVal.Calculates the minimal eigen value of gradient matrices for corner detection. Function calculates and stores only the minimal eigen value of derivative covariation matrix for every pixel.
3. PreCornerDetect.Function calculates the feature map for corner detection.

## Commands parameters

Command has 5 parameters:

1. Source picture: You need select source picture.Source picture must be single channel and must be activated before use of this function. You can select Picture_0 to Picture_19.
2. Destination picture: You need select destination picture.Destination picture must be single channel Source and destination picture can be same.You can select Picture_0 to Picture_19.
3. Type of detector: You can select corner detection function. It can be CornerHarris,CornerMinEigenVal or PreCornerDetect.
4. Aperture size: You can select size of kernel. It must be odd number between 3 and 31.
5. Block size: Neighborhood size. This parameter is active only when CornerHarris or CornerMinEigenVal function was select in parameter Type of detector.
6. Harris detector. This parameter is only active when option CornerHarris in parameter Type of detector was selected. It is Harris detector free parameter.

## Edit mode

You can set parameters(Aperture size, Block size or Haris detector) in edit window dirrectlly in the running test program. You need set break to the line with Conversion_Corners command. Then run program in debug mode. When program stops on the line with Conversion_Corners command select option "Run one step" from toolbar or menu. Then edit window with tested image will display. You can set parameters number to the line, when you press enter new picture with updated parameters will display. When you click Exit, you can select if you want save new parameters.If you select "Yes" option, test program will update with new values.

## Error codes

1. Error code -11:Bad source picture position on picture array. Source Picture is not from range 0 to 19. Check test program file if command has correct format.
2. Error code -12: Bad destination picture position on picture array. Destination picture is not from range 0 to 19. Check test program file if command has correct format.
3. Error code -13: Bad aperture size number.Aperture size must be odd number, between 3 and 31.
4. Error code -14: Bad block size number. Block size must be higher than 0.
5. Error code -15: Dimension source and destination image are not same. Dimensions (height, width) source and destination picture must be same
6. Error code -16: Channel number of source image must be 1
7. Error code -17: Channel number of destination image must be 1
8. Error code -100: OpenCV error. Explanation of this error will be displayed in result window.