Commit a989673b authored by chsin's avatar chsin Committed by Mark Daoust
Browse files

call dispose on Graphics2D

parent 3470b58a
...@@ -17,6 +17,7 @@ import static object_detection.protos.StringIntLabelMapOuterClass.StringIntLabel ...@@ -17,6 +17,7 @@ import static object_detection.protos.StringIntLabelMapOuterClass.StringIntLabel
import static object_detection.protos.StringIntLabelMapOuterClass.StringIntLabelMapItem; import static object_detection.protos.StringIntLabelMapOuterClass.StringIntLabelMapItem;
import com.google.protobuf.TextFormat; import com.google.protobuf.TextFormat;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte; import java.awt.image.DataBufferByte;
import java.io.File; import java.io.File;
...@@ -149,7 +150,9 @@ public class DetectObjects { ...@@ -149,7 +150,9 @@ public class DetectObjects {
if (img.getType() != BufferedImage.TYPE_3BYTE_BGR) { if (img.getType() != BufferedImage.TYPE_3BYTE_BGR) {
BufferedImage newImage = new BufferedImage( BufferedImage newImage = new BufferedImage(
img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR); img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
newImage.createGraphics().drawImage(img, 0, 0, img.getWidth(), img.getHeight(), null); Graphics2D g = newImage.createGraphics();
g.drawImage(img, 0, 0, img.getWidth(), img.getHeight(), null);
g.dispose();
img = newImage; img = newImage;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment