All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opencv.core.MatOfDMatch Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
/*
 * Copyright (c) 2010-2020, sikuli.org, sikulix.com - MIT license
 */

package org.opencv.core;

import java.util.Arrays;
import java.util.List;

import org.opencv.core.DMatch;

public class MatOfDMatch extends Mat {
    // 32FC4
    private static final int _depth = CvType.CV_32F;
    private static final int _channels = 4;

    public MatOfDMatch() {
        super();
    }

    protected MatOfDMatch(long addr) {
        super(addr);
        if( !empty() && checkVector(_channels, _depth) < 0 )
            throw new IllegalArgumentException("Incompatible Mat: " + toString());
        //FIXME: do we need release() here?
    }

    public static MatOfDMatch fromNativeAddr(long addr) {
        return new MatOfDMatch(addr);
    }

    public MatOfDMatch(Mat m) {
        super(m, Range.all());
        if( !empty() && checkVector(_channels, _depth) < 0 )
            throw new IllegalArgumentException("Incompatible Mat: " + toString());
        //FIXME: do we need release() here?
    }

    public MatOfDMatch(DMatch...ap) {
        super();
        fromArray(ap);
    }

    public void alloc(int elemNumber) {
        if(elemNumber>0)
            super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
    }


    public void fromArray(DMatch...a) {
        if(a==null || a.length==0)
            return;
        int num = a.length;
        alloc(num);
        float buff[] = new float[num * _channels];
        for(int i=0; i ldm) {
        DMatch adm[] = ldm.toArray(new DMatch[0]);
        fromArray(adm);
    }

    public List toList() {
        DMatch[] adm = toArray();
        return Arrays.asList(adm);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy