May 2018
Intermediate to advanced
404 pages
9h 37m
English
The runPix2PixBlurryModel method is similar to the code in the previous chapters where we used an image input to feed into our models. We first get the RGB values from the image bitmap and save them to a float array:
void runPix2PixBlurryModel() { int[] intValues = new int[WANTED_WIDTH * WANTED_HEIGHT]; float[] floatValues = new float[WANTED_WIDTH * WANTED_HEIGHT * 3]; float[] outputValues = new float[WANTED_WIDTH * WANTED_HEIGHT * 3]; try { Bitmap bitmap = BitmapFactory.decodeStream(getAssets().open(IMAGE_NAME)); Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, WANTED_WIDTH, WANTED_HEIGHT, true); scaledBitmap.getPixels(intValues, 0, scaledBitmap.getWidth(), 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight()); ...Read now
Unlock full access