简体   繁体   中英

How to change if i only wanna to detect half of the image using cvgoodfeaturetotrack

cvGoodFeaturesToTrack (frame1_1C, eig_image, temp_image, frame1_features, &number_of_features, .01, .01, NULL);

What value can i put in the mask parameter if i want to detect only half of the image??

Modify the input image to the function to contain only the part of the image that you want to calculate the good features in.

frame1_1C = frame1_1C(Range(x1,y1), Range(x2,y2));

You could use 0 - for not considering pixek and 255 to consider. The code to select the left half of your image (img) would be:

cv::Mat mask(img.size(), CV_8UC1);       // create mask mat
mask.setTo(0);                           // initialize with 0         
cv::Mat(mask, cv::Rect(0,0, mask.cols / 2, mask.rows)).setTo(255); // set the left half to 255 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM