Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To convert to bit stream:

  • get the descriptor type with descriptors.type()
  • iterate over the descriptor matrix
  • convert each element to bit stream using bitset

For example, for ORB descriptor, the desciptor type is CV_8U, the descriptor size is 256 so there are 256/8=32 columns in the matrix.

The corresponding code prints the descriptor values with binary string:

for(int i = 0; i < descriptors.rows; i++) {
  std::string binary_string = "";
  for(int j = 0; j < descriptors.cols; j++) {
    binary_string += std::bitset< 8 >( descriptors.at<uchar>(i,j) ).to_string();
  }
  std::cout << i << ") " << binary_string << std::endl;
}