Skip to content

Aruco custom dictionary #3133

@ekkelenkamp

Description

@ekkelenkamp
System information (version)
  • OpenCV => 4.4.3
  • Operating System / Platform => Windows 64 Bit, Java binding
  • Compiler => Visual Studio 2019
Detailed description

I'm trying to create an Aruco custom dictionary using the java binding. When drawing the image, it doesn't match the configured marker. I cannot find any examples on how to do this in java.

I configured a marker like:
011
111
011

But I get as result:

011
110
010

Steps to reproduce

Here a simple test case:

  
    @Test
    public void testGithub() {
        byte[][] marker = {{0,1,1},{1,1,1},{0,1,1}};
        Dictionary dictionary = Dictionary.create(1, 3);
        dictionary.set_maxCorrectionBits(0);
        Mat markerBits = new Mat(3, 3, CV_8UC1);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                markerBits.put(i, j, marker[i][j]);
            }
        }
        Mat markerCompressed = Dictionary.getByteListFromBits(markerBits);
        dictionary.get_bytesList().push_back(markerCompressed);
        Mat markerMat = new Mat(3, 3, CV_8UC1);
        Aruco.drawMarker(dictionary, 0, 9, markerMat);
        Imgcodecs.imwrite("c:/temp/marker0.jpg", markerMat);
    }

Resulting marker is attached.

marker0

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions