• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FloatIndexer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initNativeIntrinsic

import org.bytedeco.javacpp.indexer.FloatIndexer; //导入依赖的package包/类
private void initNativeIntrinsic() {
    if (intrinsicsMat == null) {
        intrinsicsMat = new Mat(3, 3, CV_32FC1);
        FloatIndexer intrinsicIdx = intrinsicsMat.createIndexer(true);

        // init to 0
        int k = 0;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                intrinsicIdx.put(k++, 0);
            }
        }

        // set the values
        intrinsicIdx.put(0, 0, intrinsics.m00);
        intrinsicIdx.put(1, 1, intrinsics.m11);
        intrinsicIdx.put(0, 2, intrinsics.m02);
        intrinsicIdx.put(1, 2, intrinsics.m12);
        intrinsicIdx.put(2, 2, 1);
    }
}
 
开发者ID:poqudrof,项目名称:PapARt,代码行数:22,代码来源:ProjectiveDeviceP.java


示例2: fillNative

import org.bytedeco.javacpp.indexer.FloatIndexer; //导入依赖的package包/类
private void fillNative(PVector[] objectPoints,
        PVector[] imagePoints,
        Mat op, Mat ip) {

    FloatIndexer opIdx = op.createIndexer();
    FloatIndexer ipIdx = ip.createIndexer();

    // Fill the object and image matrices.
    for (int i = 0; i < objectPoints.length; i++) {
        opIdx.put(i, 0, objectPoints[i].x);
        opIdx.put(i, 1, objectPoints[i].y);
        opIdx.put(i, 2, objectPoints[i].z);

        ipIdx.put(i, 0, imagePoints[i].x);
        ipIdx.put(i, 1, imagePoints[i].y);
    }
}
 
开发者ID:poqudrof,项目名称:PapARt,代码行数:18,代码来源:ProjectiveDeviceP.java


示例3: testGetMaxPosition

import org.bytedeco.javacpp.indexer.FloatIndexer; //导入依赖的package包/类
@Test
public void testGetMaxPosition() {
  opencv_core.Mat src = LaneManager.readImage(getResourcePath(TEST_IMAGE));
  opencv_core.Mat saturationChannel = LaneManager.getSaturationChannel(src);
  opencv_core.Mat histogram = LaneManager.histogram(saturationChannel);

  // Compute manual
  float max = -1.0f;
  int maxIndex = -1;
  FloatIndexer idx = histogram.createIndexer();
  for (int row = 0; row < histogram.rows(); row++) {
    for (int col = 0; col < histogram.cols(); col++) {
      float value = idx.get(row, col);
      //System.out.println(String.format(Locale.US, "row: %d, col: %d, value: %f", row, col, value));
      if (max == -1 || value > max) {
        maxIndex = row;
        max = value;
      }
    }
  }

  // Compute with OpenCV
  HistogramPosition position = LaneManager.getMaxPosition(histogram);

  // Both results should match
  assertEquals(position.getBinIndex(), 21);
  assertEquals(position.getBinValue(), 36377.0, DELTA);
  assertEquals(position.getBinIndex(), maxIndex);
  assertEquals(position.getBinValue(), max, DELTA);
}
 
开发者ID:zugaldia,项目名称:android-robocar,代码行数:31,代码来源:LaneManagerTest.java


示例4: features

import org.bytedeco.javacpp.indexer.FloatIndexer; //导入依赖的package包/类
/**
 * Assign values to feature
 * <p>
 * 样本特征为水平、垂直直方图和低分辨率图像所组成的矢量
 * 
 * @param in
 * @param sizeData
 *            低分辨率图像size = sizeData*sizeData, 可以为0
 * @return
 */
public static Mat features(final Mat in, final int sizeData) {

    float[] vhist = projectedHistogram(in, Direction.VERTICAL);
    float[] hhist = projectedHistogram(in, Direction.HORIZONTAL);

    Mat lowData = new Mat();
    if (sizeData > 0) {
        resize(in, lowData, new Size(sizeData, sizeData));
    }

    int numCols = vhist.length + hhist.length + lowData.cols() * lowData.rows();
    Mat out = Mat.zeros(1, numCols, CV_32F).asMat();
    FloatIndexer idx = out.createIndexer();

    int j = 0;
    for (int i = 0; i < vhist.length; ++i, ++j) {
        idx.put(0, j, vhist[i]);
    }
    for (int i = 0; i < hhist.length; ++i, ++j) {
        idx.put(0, j, hhist[i]);
    }
    for (int x = 0; x < lowData.cols(); x++) {
        for (int y = 0; y < lowData.rows(); y++, ++j) {
            float val = lowData.ptr(x, y).get() & 0xFF;
            idx.put(0, j, val);
        }
    }

    return out;
}
 
开发者ID:fan-wenjie,项目名称:EasyPR-Java,代码行数:41,代码来源:CoreFunc.java


示例5: testPointerCreation

import org.bytedeco.javacpp.indexer.FloatIndexer; //导入依赖的package包/类
@Test
public void testPointerCreation() {
    FloatPointer floatPointer = new FloatPointer(1, 2, 3, 4);
    Indexer indexer = FloatIndexer.create(floatPointer);
    DataBuffer buffer = Nd4j.createBuffer(floatPointer, DataBuffer.Type.FLOAT, 4, indexer);
    DataBuffer other = Nd4j.createBuffer(new float[] {1, 2, 3, 4});
    assertArrayEquals(other.asFloat(), buffer.asFloat(), 0.001f);
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:9,代码来源:FloatDataBufferTest.java


示例6: create

import org.bytedeco.javacpp.indexer.FloatIndexer; //导入依赖的package包/类
/**
 * @param floatPointer
 * @param length
 * @return
 */
@Override
public DataBuffer create(FloatPointer floatPointer, long length) {
    floatPointer.capacity(length);
    floatPointer.limit(length);
    floatPointer.position(0);
    return new FloatBuffer(floatPointer, FloatIndexer.create(floatPointer), length);
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:13,代码来源:DefaultDataBufferFactory.java


示例7: estimateOrientation

import org.bytedeco.javacpp.indexer.FloatIndexer; //导入依赖的package包/类
public PMatrix3D estimateOrientation(PVector[] objectPoints,
            PVector[] imagePoints) {

        assert (objectPoints.length == imagePoints.length);

        Mat op = new Mat(objectPoints.length, 3, CV_32FC1);
        Mat ip = new Mat(imagePoints.length, 2, CV_32FC1);
        Mat rotation = new Mat(3, 1, CV_64FC1);
        Mat translation = new Mat(3, 1, CV_64FC1);

        if (intrinsicsMat == null) {
            intrinsicsMat = new Mat(3, 3, CV_32FC1);
            FloatIndexer intrinsicIdx = intrinsicsMat.createIndexer(true);

            // init to 0
            int k = 0;
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    intrinsicIdx.put(k++, 0);
                }
            }

            // set the values
            intrinsicIdx.put(0, 0, intrinsics.m00);
            intrinsicIdx.put(1, 1, intrinsics.m11);
            intrinsicIdx.put(0, 2, intrinsics.m02);
            intrinsicIdx.put(1, 2, intrinsics.m12);
            intrinsicIdx.put(2, 2, 1);
        }

        FloatIndexer opIdx = op.createIndexer();
        FloatIndexer ipIdx = ip.createIndexer();

        // Fill the object and image matrices.
        for (int i = 0; i < objectPoints.length; i++) {
            opIdx.put(i, 0, objectPoints[i].x);
            opIdx.put(i, 1, objectPoints[i].y);
            opIdx.put(i, 2, objectPoints[i].z);

            ipIdx.put(i, 0, imagePoints[i].x);
            ipIdx.put(i, 1, imagePoints[i].y);
        }

        //  cv::SOLVEPNP_ITERATIVE = 0, 
        //  cv::SOLVEPNP_EPNP = 1, 
//  cv::SOLVEPNP_P3P = 2, 
//  cv::SOLVEPNP_DLS = 3, 
//  cv::SOLVEPNP_UPNP = 4 
// Convert all to Mat, instead of CvMat
        boolean solved = opencv_calib3d.solvePnP(op,
                ip,
                new Mat(intrinsicsMat), new Mat(),
                rotation, translation,
                false, opencv_calib3d.SOLVEPNP_ITERATIVE);

        Mat rotMat = new Mat(3, 3, CV_64FC1);
        Rodrigues(rotation, rotMat);

        double[] rotationIndex = (double[]) rotMat.createIndexer(false).array();
        double[] translationIndex = (double[]) translation.createIndexer(false).array();

//        float RTMat[] = {
//            (float) rotationIndex[0], (float) rotationIndex[1], (float) rotationIndex[2], (float) translationIndex[0],
//            (float) rotationIndex[3], (float) rotationIndex[4], (float) rotationIndex[5], (float) translationIndex[1],
//            (float) rotationIndex[6], (float) rotationIndex[7], (float) rotationIndex[8], (float) translationIndex[2],
//            0, 0, 0, 1f};

        PMatrix3D mat = new PMatrix3D((float) rotationIndex[0], (float) rotationIndex[1], (float) rotationIndex[2], (float) translationIndex[0],
                (float) rotationIndex[3], (float) rotationIndex[4], (float) rotationIndex[5], (float) translationIndex[1],
                (float) rotationIndex[6], (float) rotationIndex[7], (float) rotationIndex[8], (float) translationIndex[2],
                0, 0, 0, 1f);
//        mat.set(RTMat);

        return mat;
    }
 
开发者ID:poqudrof,项目名称:PapAR,代码行数:76,代码来源:ProjectiveDeviceP.java



注:本文中的org.bytedeco.javacpp.indexer.FloatIndexer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IntCollection类代码示例发布时间:2022-05-23
下一篇:
Java VLayout类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap