/** Returns {@code create(pointer, sizes, strides, true)} */ public static UByteIndexer create(BytePointer pointer, long[] sizes, long[] strides) { return create(pointer, sizes, strides, true); } /**
/** Returns {@code this} where {@code b[offset:offset + length] = array/buffer[i]} */ public abstract UByteIndexer get(long i, int[] b, int offset, int length); /** Returns {@code array/buffer[i * strides[0] + j]} */
/** Returns {@code this} where {@code array/buffer[i * strides[0] + j] = b[offset:offset + length]} */ public abstract UByteIndexer put(long i, long j, int[] b, int offset, int length); /** Returns {@code this} where {@code array/buffer[i * strides[0] + j * strides[1] + k] = b} */
switch (imageDepth) { case DEPTH_UBYTE: return array != null ? (I)UByteIndexer.create((byte[])array, sizes, strides).indexable(this) : direct ? (I)UByteIndexer.create((ByteBuffer)buffer, sizes, strides).indexable(this) : (I)UByteIndexer.create(new BytePointer((ByteBuffer)buffer), sizes, strides, false).indexable(this); case DEPTH_BYTE: return array != null ? (I)ByteIndexer.create((byte[])array, sizes, strides).indexable(this)
private void erodePoints(boolean[] arrayToErode) { for (int i = 0; i < getWidth() * getHeight(); i++) { erosionIndexer.put(i, arrayToErode[i] ? 1 : 0); } cvErode(nativeArrayToErode, nativeArrayToErode); for (int i = 0; i < getWidth() * getHeight(); i++) { arrayToErode[i] = erosionIndexer.get(i) == 1; } }
switch (imageDepth) { case DEPTH_UBYTE: return array != null ? (I)UByteIndexer.create((byte[])array, sizes, strides).indexable(this) : direct ? (I)UByteIndexer.create((ByteBuffer)buffer, sizes, strides).indexable(this) : (I)UByteIndexer.create(new BytePointer((ByteBuffer)buffer), sizes, strides, false).indexable(this); case DEPTH_BYTE: return array != null ? (I)ByteIndexer.create((byte[])array, sizes, strides).indexable(this)
/** Returns {@code this} where {@code b[offset:offset + length] = array/buffer[i * strides[0] + j]} */ public abstract UByteIndexer get(long i, long j, int[] b, int offset, int length); /** Returns {@code array/buffer[i * strides[0] + j * strides[1] + k]} */
/** Returns {@code create(pointer, { pointer.limit() - pointer.position() }, { 1 }, true)} */ public static UByteIndexer create(BytePointer pointer) { return create(pointer, new long[] { pointer.limit() - pointer.position() }, ONE_STRIDE); }
/** Returns {@code this} where {@code array/buffer[i] = b[offset:offset + length]} */ public abstract UByteIndexer put(long i, int[] b, int offset, int length); /** Returns {@code this} where {@code array/buffer[i * strides[0] + j] = b} */
/** Returns {@code this} where {@code b[offset:offset + length] = array/buffer[index(indices)]} */ public abstract UByteIndexer get(long[] indices, int[] b, int offset, int length);
@Override public UByteIndexer createIndexer(boolean direct) { int w = pixGetWidth((PIX)this); int h = pixGetHeight((PIX)this); int d = pixGetDepth((PIX)this); int wpl = pixGetWpl((PIX)this); long[] sizes = {h, w, d / 8}; long[] strides = {wpl * 4, d / 8, 1}; BytePointer data = new BytePointer(pixGetData((PIX)this)).capacity(h * wpl * 4); return UByteIndexer.create(data, sizes, strides, direct); }
/** Returns {@code this} where {@code array/buffer[index(indices)] = b[offset:offset + length]} */ public abstract UByteIndexer put(long[] indices, int[] b, int offset, int length);
@Override public double getDouble(long... indices) { return get(indices); } @Override public UByteIndexer putDouble(long[] indices, double b) { return put(indices, (int)b); }
@Override public UByteIndexer putDouble(long[] indices, double b) { return put(indices, (int)b); } }
if (statusIndex.get(j) != 0) {