代码之家  ›  专栏  ›  技术社区  ›  Laurenz

阿鲁科期望什么样的图像编码?

  •  1
  • Laurenz  · 技术社区  · 8 年前

    我的应用程序接收可以 bayer_rggb8 编码。我需要把这些图像转换成 bgr8 / rgb8 / mono8 ?或者Aruco能检测到Bayer编码的标记吗? cv::Mat S?

    我用的是阿鲁科3.0.10。下面是我正在使用的函数。

        /**Detects the markers in the image passed
            *
            * If you provide information about the camera parameters and the size of the marker, then, the extrinsics of
         * the markers are detected
            *
            * @param input input color image
            * @param detectedMarkers output vector with the markers detected
            * @param camParams Camera parameters
            * @param markerSizeMeters size of the marker sides expressed in meters
            * @param setYPerperdicular If set the Y axis will be perpendicular to the surface. Otherwise, it will be the
         * Z axis
            */
        void detect(const cv::Mat& input, std::vector<Marker>& detectedMarkers, CameraParameters camParams,
                    float markerSizeMeters = -1, bool setYPerperdicular = false);
    

    我试着把它 拜耳RGGB8 编码的图像,似乎可以工作(它检测标记)。但我想知道这是否有效,或者我只是幸运的我的测试图像。

    左:原始图像,错误显示为BRG8。右:图像转换/颜色插值到BGR8并用标记进行注释。(在左侧图像上检测到标记。) enter image description here

    1 回复  |  直到 8 年前
        1
  •  1
  •   Miki    8 年前

    它接受 CV_8UC1 灰度图像( mono8 或A CV_8UC3 彩色图像( bgr8 )它不适用于拜耳编码的垫子。


    如果有疑问,请检查源代码。

    你可以看到 aruco.cpp 第一个操作是将图像转换为灰度:

    _convertToGrey(_image.getMat(), grey);
    

    功能 _convertToGray 接受 简历-8UC1 (已经可以)或 简历-8UC3 (转换为灰度):

    static void _convertToGrey(InputArray _in, OutputArray _out) {
    
        CV_Assert(_in.getMat().channels() == 1 || _in.getMat().channels() == 3);
    
        _out.create(_in.getMat().size(), CV_8UC1);
        if(_in.getMat().type() == CV_8UC3)
            cvtColor(_in.getMat(), _out.getMat(), COLOR_BGR2GRAY);
        else
            _in.getMat().copyTo(_out);
    }