Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created February 22, 2019 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogermcs/478ebe371393e9a8722cdcb665deb812 to your computer and use it in GitHub Desktop.
Save frogermcs/478ebe371393e9a8722cdcb665deb812 to your computer and use it in GitHub Desktop.
public static Bitmap prepareImageForClassification(Bitmap bitmap) {
Paint paint = new Paint();
Bitmap finalBitmap = Bitmap.createScaledBitmap(
bitmap,
GtsrbModelConfig.INPUT_IMG_SIZE_WIDTH,
GtsrbModelConfig.INPUT_IMG_SIZE_HEIGHT,
false);
Canvas canvas = new Canvas(finalBitmap);
canvas.drawBitmap(finalBitmap, 0, 0, paint);
return finalBitmap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment