1

我的应用程序接收可以具有bayer_rggb8编码的相机图像。我需要将这些图像转换为bgr8//吗rgb8mono8或者 Aruco 可以检测拜耳编码cv::Mat的标记吗?

我正在使用 Aruco 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);

我试图只给它bayer_rggb8编码的图像,这似乎有效(它检测标记)。但我想知道这是否应该工作,或者我是否对我的测试图像很幸运。

左:原始图像,错误显示为 brg8。右:图像转换/颜色插值到 BGR8 并用标记进行注释。(在左侧图像上检测到标记。) 在此处输入图像描述

4

1 回答 1

1

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


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

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

_convertToGrey(_image.getMat(), grey);

该函数_convertToGray接受CV_8UC1(已经可以)或CV_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);
}
于 2018-05-23T09:25:34.383 回答