// Capture the current frame
cap >> frame;
// Resize the frame
resize(frame, frame, Size(), scalingFactor, scalingFactor, INTER_AREA);
// Convert to grayscale
cvtColor(frame, frameGray, COLOR_BGR2GRAY );
// Initialize the parameters for Shi-Tomasi algorithm
vector<Point2f> corners;
double qualityThreshold = 0.02;
double minDist = 15;
int blockSize = 5;
bool useHarrisDetector = false;
double k = 0.07;
// Clone the input frame
Mat frameCopy;
frameCopy = frame.clone();
// Apply corner detection
goodFeaturesToTrack(frameGray, corners, numCorners, qualityThreshold, minDist, Mat(), blockSize, useHarrisDetector, k);
// Parameters for the circles to display the corners
int radius = 8; // radius of the cirles
int thickness = 2; // thickness of the circles
int lineType = 8;
// Draw the detected corners using circles
for(size_t i = 0; i < corners.size(); i++)
{
Scalar color = Scalar(rng.uniform(0,255), rng.uniform(0,255), rng.uniform(0,255));
circle(frameCopy, corners[i], radius, color, thickness, lineType, 0);
}