@Override public INDArray asMatrix(Object image) throws IOException { return image instanceof Bitmap ? asMatrix((Bitmap) image) : null; }
@Override public INDArray asRowVector(Object image) throws IOException { return image instanceof Bitmap ? asRowVector((Bitmap) image) : null; }
/** * Calls {@link AndroidNativeImageLoader#asMatrix(android.graphics.Bitmap)} or * {@link Java2DNativeImageLoader#asMatrix(java.awt.image.BufferedImage)}. * @param image as a {@link android.graphics.Bitmap} or {@link java.awt.image.BufferedImage} * @return the matrix or null for unsupported object classes * @throws IOException */ public INDArray asMatrix(Object image) throws IOException { INDArray array = null; if (array == null) { try { array = new AndroidNativeImageLoader(this).asMatrix(image); } catch (NoClassDefFoundError e) { // ignore } } if (array == null) { try { array = new Java2DNativeImageLoader(this).asMatrix(image); } catch (NoClassDefFoundError e) { // ignore } } return array; }
public INDArray asRowVector(Bitmap image) throws IOException { return asMatrix(image).ravel(); }
public INDArray asMatrix(Bitmap image) throws IOException { if (converter == null) { converter = new OpenCVFrameConverter.ToMat(); } return asMatrix(converter.convert(converter2.convert(image))); }