本文整理汇总了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;未经允许,请勿转载。 |
请发表评论