Skip to content

Commit

Permalink
Accept 8 and 16 bit grayscale images for object detection
Browse files Browse the repository at this point in the history
  • Loading branch information
kinhong committed Feb 11, 2020
1 parent 6d52d0d commit 0268fa0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ private static void bgr2rgb(byte[] data) {
}

private static Tensor<UInt8> makeImageTensor(BufferedImage img) throws IOException {
if (img.getType() == BufferedImage.TYPE_BYTE_INDEXED || img.getType() == BufferedImage.TYPE_BYTE_BINARY) {
if (img.getType() == BufferedImage.TYPE_BYTE_INDEXED
|| img.getType() == BufferedImage.TYPE_BYTE_BINARY
|| img.getType() == BufferedImage.TYPE_BYTE_GRAY
|| img.getType() == BufferedImage.TYPE_USHORT_GRAY) {
BufferedImage bgr = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
bgr.getGraphics().drawImage(img, 0, 0, null);
img = bgr;
Expand Down

0 comments on commit 0268fa0

Please sign in to comment.