Mat image = new Mat("input_image.jpg", ImreadModes.Grayscale); Mat corners = new Mat(); CvInvoke.GoodFeaturesToTrack(image, corners, 100, 0.01, 10); CvInvoke.CornerSubPix(image, corners, new Size(5,5), new Size(-1,-1), new MCvTermCriteria(30, 0.01));
Mat grayImage = new Mat(); CvInvoke.CvtColor(image, grayImage, ColorConversion.Bgr2Gray); Mat corners = new Mat(); CvInvoke.GoodFeaturesToTrack(grayImage, corners, 100, 0.01, 10); CvInvoke.CornerSubPix(grayImage , corners, new Size(5,5), new Size(-1,-1), new MCvTermCriteria(30, 0.01));Here, we start by reading in an image and converting it to grayscale using the CvInvoke CvtColor method. We then use the GoodFeaturesToTrack method to detect up to 100 corners in the image. Finally, we use the CornerSubPix method to refine the position of these corners using a 5x5 window and a termination criteria of 30 iterations or a change of less than 0.01 in the corner's position. Based on the usage of the "CvInvoke" prefix and the "Mat" data type, it can be determined that these examples are using the OpenCV library.