• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DoubleIndexer类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.bytedeco.javacpp.indexer.DoubleIndexer的典型用法代码示例。如果您正苦于以下问题:Java DoubleIndexer类的具体用法?Java DoubleIndexer怎么用?Java DoubleIndexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DoubleIndexer类属于org.bytedeco.javacpp.indexer包,在下文中一共展示了DoubleIndexer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generateUndistortedAddressLUT

点赞 2

import org.bytedeco.javacpp.indexer.DoubleIndexer; //导入依赖的package包/类
/**
 * Generate a look-up table that maps the entire chip to undistorted
 * addresses.
 *
 * @param sx chip size x
 * @param sy chip size y
 */
public void generateUndistortedAddressLUT() {
    if (!calibrated) {
        return;
    }

    if ((sx == 0) || (sy == 0)) {
        return; // not set yet
    }
    FloatPointer fp = new FloatPointer(2 * sx * sy);
    int idx = 0;
    for (int x = 0; x < sx; x++) {
        for (int y = 0; y < sy; y++) {
            fp.put(idx++, x);
            fp.put(idx++, y);
        }
    }
    Mat dst = new Mat();
    Mat pixelArray = new Mat(1, sx * sy, CV_32FC2, fp); // make wide 2 channel matrix of source event x,y
    opencv_imgproc.undistortPoints(pixelArray, dst, getCameraMatrix(), getDistortionCoefs());
    isUndistortedAddressLUTgenerated = true;
    // get the camera matrix elements (focal lengths and principal point)
    DoubleIndexer k = getCameraMatrix().createIndexer();
    float fx, fy, cx, cy;
    fx = (float) k.get(0, 0);
    fy = (float) k.get(1, 1);
    cx = (float) k.get(0, 2);
    cy = (float) k.get(1, 2);
    undistortedAddressLUT = new short[2 * sx * sy];

    for (int x = 0; x < sx; x++) {
        for (int y = 0; y < sy; y++) {
            idx = 2 * (y + (sy * x));
            undistortedAddressLUT[idx] = (short) Math.round((dst.getFloatBuffer().get(idx) * fx) + cx);
            undistortedAddressLUT[idx + 1] = (short) Math.round((dst.getFloatBuffer().get(idx + 1) * fy) + cy);
        }
    }
}
 

开发者ID:SensorsINI,
项目名称:jaer,
代码行数:45,
代码来源:SingleCameraCalibration.java

示例2: generateUndistortedAddressLUT

点赞 2

import org.bytedeco.javacpp.indexer.DoubleIndexer; //导入依赖的package包/类
/**
 * Generate a look-up table that maps the entire chip to undistorted
 * addresses.
 *
 * @param sx chip size x
 * @param sy chip size y
 */
public void generateUndistortedAddressLUT() {
	if (!calibrated) {
		return;
	}

	if ((sx == 0) || (sy == 0)) {
		return; // not set yet
	}
	FloatPointer fp = new FloatPointer(2 * sx * sy);
	int idx = 0;
	for (int x = 0; x < sx; x++) {
		for (int y = 0; y < sy; y++) {
			fp.put(idx++, x);
			fp.put(idx++, y);
		}
	}
	Mat dst = new Mat();
	Mat pixelArray = new Mat(1, sx * sy, CV_32FC2, fp); // make wide 2 channel matrix of source event x,y
	opencv_imgproc.undistortPoints(pixelArray, dst, getCameraMatrix(), getDistortionCoefs());
	isUndistortedAddressLUTgenerated = true;
	// get the camera matrix elements (focal lengths and principal point)
	DoubleIndexer k = getCameraMatrix().createIndexer();
	float fx, fy, cx, cy;
	fx = (float) k.get(0, 0);
	fy = (float) k.get(1, 1);
	cx = (float) k.get(0, 2);
	cy = (float) k.get(1, 2);
	undistortedAddressLUT = new short[2 * sx * sy];

	for (int x = 0; x < sx; x++) {
		for (int y = 0; y < sy; y++) {
			idx = 2 * (y + (sy * x));
			undistortedAddressLUT[idx] = (short) Math.round((dst.getFloatBuffer().get(idx) * fx) + cx);
			undistortedAddressLUT[idx + 1] = (short) Math.round((dst.getFloatBuffer().get(idx + 1) * fy) + cy);
		}
	}
}
 

开发者ID:SensorsINI,
项目名称:jaer,
代码行数:45,
代码来源:SingleOrStereoCameraCalibration.java

示例3: testPointerCreation

点赞 2

import org.bytedeco.javacpp.indexer.DoubleIndexer; //导入依赖的package包/类
@Test
public void testPointerCreation() {
    DoublePointer floatPointer = new DoublePointer(1, 2, 3, 4);
    Indexer indexer = DoubleIndexer.create(floatPointer);
    DataBuffer buffer = Nd4j.createBuffer(floatPointer, DataBuffer.Type.DOUBLE, 4, indexer);
    DataBuffer other = Nd4j.createBuffer(new double[] {1, 2, 3, 4});
    assertArrayEquals(other.asDouble(), buffer.asDouble(), 0.001);
}
 

开发者ID:deeplearning4j,
项目名称:nd4j,
代码行数:9,
代码来源:DoubleDataBufferTest.java

示例4: create

点赞 2

import org.bytedeco.javacpp.indexer.DoubleIndexer; //导入依赖的package包/类
/**
 * @param doublePointer
 * @param length
 * @return
 */
@Override
public DataBuffer create(DoublePointer doublePointer, long length) {
    doublePointer.capacity(length);
    doublePointer.limit(length);
    doublePointer.position(0);
    return new DoubleBuffer(doublePointer, DoubleIndexer.create(doublePointer), length);
}
 

开发者ID:deeplearning4j,
项目名称:nd4j,
代码行数:13,
代码来源:DefaultDataBufferFactory.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)