How to populate a custom binary feature descriptor in opencv?
I have a binary vector generated for each keypoint as its description. I would like to create my own binary descriptor matrix. I understand that descriptors are just matrices. Binary descriptor is a matrix with depth CV_8U. Below is my code to create the matrix. But is there an easy way to populate it?
//I have 4096 bit data for descriptor. So 4096/8=512 will be my bytes
cv::Mat descriptors;
int bytes_ = 512;
descriptors.create((int)keypoints.size(), bytes_ , CV_8U);
I have the binary data in the form of four 32X32 binary images. How do I encode this data into the descriptor matrix? Is it the right way if I read 8 pixels at a time and convert them into a single uchar (byte) and then use it as my descriptor matrix element? Later, I want to use this descriptor with opencv's DescriptorMatcher to match the descriptors.