opencvtype-conversionuint64opencv-mat

Convert uint64_t to cv::mat


what I have:

 std::vector<cv::KeyPoint> keypoints;
    uint64_t* desc = new uint64_t[8 * keypoints.size()];    
    cv::Mat test = (keypoints.size(), 8, CV_8UC1, desc);

That does not work. What am I missing?

Error message is: no suitable constructor exists to convert from "uint64_t *" to "cv::Mat" and "Cannot initialize local variable test of type cv::Mat with lvalue of type unsigned long long" Thank you


Solution

  • Your syntax for calling the cv::Mat constructor is incorrect, try:

    cv::Mat test(keypoints.size(), 8, CV_8UC1, desc);