Difference of OpenCV Mat types

后端 未结 1 836
太阳男子
太阳男子 2020-12-16 12:18

What are the differences between OpenCV cv::Mat types?

To be more specific, what is the difference between CV_64F and CV_64FC1

相关标签:
1条回答
  • 2020-12-16 12:41

    Cx part shows number of channels in an image. That is, image of type CV_64FC1 is simple grayscale image and has only 1 channel:

    image[i, j] = 0.5
    

    while image of type CV_64F3 is colored image with 3 channels:

    image[i, j] = (0.5, 0.3, 0.7)
    

    (in C++ you can check individual pixels as image.at<double>(i, j))

    CV_64F is the same as CV_64FC1. So if you need just 2D matrix (i.e. single channeled) you can just use CV_64F


    EDIT

    More generally, type name of a Mat object consists of several parts. Here's example for CV_64FC1:

    • CV_ - this is just a prefix
    • 64 - number of bits per base matrix element (e.g. pixel value in grayscale image or single color element in BGR image)
    • F - type of the base element. In this case it's F for float, but can also be S (signed) or U (unsigned)
    • Cx - number of channels in an image as I outlined earlier
    0 讨论(0)
提交回复
热议问题