本文整理汇总了Java中org.bytedeco.javacpp.indexer.UByteIndexer类的典型用法代码示例。如果您正苦于以下问题:Java UByteIndexer类的具体用法?Java UByteIndexer怎么用?Java UByteIndexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UByteIndexer类属于org.bytedeco.javacpp.indexer包,在下文中一共展示了UByteIndexer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPixel
import org.bytedeco.javacpp.indexer.UByteIndexer; //导入依赖的package包/类
@Override
public Color getPixel(final int x, final int y) {
LOG.traceEntry("getPixel(x={}, y={})", x, y);
final UByteIndexer indexer = matrix.createIndexer();
try {
final int blue = indexer.get(y, x, 0);
final int green = indexer.get(y, x, 1);
final int red = indexer.get(y, x, 2);
return LOG.traceExit(new Color(red, green, blue));
} finally {
indexer.release();
}
}
示例2: makeRandomImage
import org.bytedeco.javacpp.indexer.UByteIndexer; //导入依赖的package包/类
public static ImageWritable makeRandomImage(int height, int width, int channels) {
if (height <= 0) {
height = rng.nextInt() % 100 + 200;
}
if (width <= 0) {
width = rng.nextInt() % 100 + 200;
}
Mat img = new Mat(height, width, CV_8UC(channels));
UByteIndexer idx = img.createIndexer();
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
for (int k = 0; k < channels; k++) {
idx.put(i, j, k, rng.nextInt());
}
}
}
Frame frame = converter.convert(img);
return new ImageWritable(frame);
}
示例3: makeRandomImage
import org.bytedeco.javacpp.indexer.UByteIndexer; //导入依赖的package包/类
Mat makeRandomImage(int height, int width, int channels) {
if (height <= 0) {
height = rng.nextInt() % 100 + 100;
}
if (width <= 0) {
width = rng.nextInt() % 100 + 100;
}
Mat img = new Mat(height, width, CV_8UC(channels));
UByteIndexer idx = img.createIndexer();
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
for (int k = 0; k < channels; k++) {
idx.put(i, j, k, rng.nextInt());
}
}
}
return img;
}
示例4: bytedecoMatToCVMat
import org.bytedeco.javacpp.indexer.UByteIndexer; //导入依赖的package包/类
/**
* Converts a bytedeco Mat to an OpenCV Mat.
*
* @param input the bytedeco Mat to convert
* @return an OpenCV Mat
*/
public static Mat bytedecoMatToCVMat(org.bytedeco.javacpp.opencv_core.Mat input) {
UByteIndexer idxer = input.createIndexer();
Mat out = new Mat(idxer.rows(), idxer.cols(), CvType.CV_8UC(idxer.channels()));
//Mat out = new Mat(idxer.rows(),idxer.cols(),input.type());
for (int row = 0; row < idxer.rows(); row++) {
for (int col = 0; col < idxer.cols(); col++) {
byte[] data = new byte[3];
for (int channel = 0; channel < idxer.channels(); channel++) {
data[channel] = (byte) (idxer.get(row, col, channel) & 0xFF);
}
out.put(row, col, data);
}
}
return out;
}
示例5: init
import org.bytedeco.javacpp.indexer.UByteIndexer; //导入依赖的package包/类
private void init() {
validPointsPImage = papplet.createImage(getDepthWidth(), getDepthHeight(), PConstants.RGB);
nativeArrayToErode = IplImage.create(getDepthWidth(), getDepthHeight(), IPL_DEPTH_8U, 1);
erosionIndexer = (UByteIndexer) nativeArrayToErode.createIndexer();
validCopy = Arrays.copyOf(depthData.validPointsMask, depthData.validPointsMask.length);
}