stytim/k4a-calibration

[compiler error] Aruco dictionary is protected

Closed this issue · 1 comments

[ 33%] Building CXX object CMakeFiles/calib_k4a.dir/src/camera_extrinsics.cpp.o
/home/ccnam/Downloads/k4a-calibration/src/camera_extrinsics.cpp: In member function ‘bool ExtrinsicsCalibration::CalculateExtrinsics(const std::vector<FrameInfo>&, std::vector<AlignmentTransform>&)’:
/home/ccnam/Downloads/k4a-calibration/src/camera_extrinsics.cpp:213:51: error: ‘cv::Ptr<cv::aruco::Dictionary> cv::aruco::Board::dictionary’ is protected within this context
             cv::aruco::detectMarkers(gray, board->dictionary, markerCorners, markerIds, params);
                                                   ^~~~~~~~~~
In file included from /usr/local/include/opencv4/opencv2/aruco_detector.hpp:6:0,
                 from /usr/local/include/opencv4/opencv2/aruco.hpp:7,
                 from /usr/local/include/opencv4/opencv2/aruco/charuco.hpp:9,
                 from /home/ccnam/Downloads/k4a-calibration/include/camera_extrinsics.hpp:11,
                 from /home/ccnam/Downloads/k4a-calibration/src/camera_extrinsics.cpp:1:
/usr/local/include/opencv4/opencv2/aruco/board.hpp:89:29: note: declared protected here
     CV_PROP Ptr<Dictionary> dictionary;
                             ^~~~~~~~~~
CMakeFiles/calib_k4a.dir/build.make:75: recipe for target 'CMakeFiles/calib_k4a.dir/src/camera_extrinsics.cpp.o' failed
make[2]: *** [CMakeFiles/calib_k4a.dir/src/camera_extrinsics.cpp.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/calib_k4a.dir/all' failed
make[1]: *** [CMakeFiles/calib_k4a.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2

Aruco is protected

sudo vim /usr/local/include/opencv4/opencv2/aruco/board.hpp

then change protected to public

board.hpp

public:
    /** @brief array of object points of all the marker corners in the board each marker include its 4 corners in this order:
     * -   objPoints[i][0] - left-top point of i-th marker
     * -   objPoints[i][1] - right-top point of i-th marker
     * -   objPoints[i][2] - right-bottom point of i-th marker
     * -   objPoints[i][3] - left-bottom point of i-th marker
     *
     * Markers are placed in a certain order - row by row, left to right in every row.
     * For M markers, the size is Mx4.
     */
    CV_PROP std::vector<std::vector<Point3f> > objPoints;

    /// the dictionary of markers employed for this board
    CV_PROP Ptr<Dictionary> dictionary;

    /// coordinate of the bottom right corner of the board, is set when calling the function create()
    CV_PROP Point3f rightBottomBorder;

    /** @brief vector of the identifiers of the markers in the board (same size than objPoints)
     * The identifiers refers to the board dictionary
     */
    CV_PROP_RW std::vector<int> ids;
};