Greetings and best wishes for a happy set of holidays.
I am now able to fill a TUint8 tensor with the byte array from grayscale image pixels. Setting the NDArray one pixel at a time looks horribly inefficient. I was hoping someone might be willing to suggest a way to improve the code.
BufferedImage buffImg = //provide a grayscale Bufferedimage byte bA = //get the byte array of gray values from buffImg int width = buffImg.getWidth(); int height = buffImg.getHeight(); Shape theShape = Shape.of(1,height,width,1); ByteNdArray pixValueMatrix = NdArrays.ofBytes(theShape); for(int j=0; j<height; j++) for(int i=0; i<width; i++) pixValueMatrix.setByte(bA[j*width+i],0,j,i,0); TUint8 theTens = TUint8.tensorOf(pixValueMatrix);