Generate a mask for FAST keypoints in c++
im trying I want to use a mask FAST keypoints to compute improve the SIFT descriptors. The idea is the following:detector and find keypoints more easily.
I have tried doing this many times but i have a problem
with
FAST Create a mask with those keypoints Pass that mask in converting the
detectAndCompute method of the SIFT algorithm point to 8 bit unsigned int. Here is my code:
fast->detect(frame, fkps2);
std::vector<cv::Point2i> mask;
cv::Mat mask = cv::Mat();
for (int i = 0; i < sizeof(fkps2); size(fkps2); i++) {
mask[i] = fkps2[i].pt;
mask.push_back(cv::Mat(fkps2[i].pt));
}
algo->detectAndCompute(frame, mask, keypoints2, descriptors2, true);
In python i did this This does generate the following way:mask without a problem, but the problem occures when passing the mask in the detect function of SIFT:
mask = np.array([np.uint8(k.pt[0]) for k in kp2])
algo->detect(frame, keypoints2, mask);
However Here it says that types of points in C++ mask must be 8 bit unsigned ints. Basically, the each of fkps2[i].pt
needs to be converted to an unsigned int.
I have done research and tried many ways of doing this doesnt work (the point2 int vector mask cant be applied to frame)but was unsuccessful in doing so.