From: EvanYap Date: Tue, 18 Oct 2016 01:49:15 +0000 (-0700) Subject: setup things, not really sure what happened. oh yeah fix opencv X-Git-Url: http://challenge-bot.com/repos/?p=3501%2FOpenCVShowImage;a=commitdiff_plain setup things, not really sure what happened. oh yeah fix opencv --- diff --git a/GoalTracker.java b/GoalTracker.java index 90d8be3..bab65e8 100644 --- a/GoalTracker.java +++ b/GoalTracker.java @@ -97,7 +97,7 @@ public class GoalTracker { Imgproc.cvtColor(matOriginal, matHSV, Imgproc.COLOR_BGR2HSV); Core.inRange(matHSV, LOWER_BOUNDS, UPPER_BOUNDS, matThresh); - // Imgcodecs.imwrite("output.png", matThresh); + Imgcodecs.imwrite("output.png", matThresh); Imgproc.findContours(matThresh, contours, matHeirarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); @@ -131,18 +131,14 @@ public class GoalTracker { Point center = new Point(rec.br().x - rec.width / 2 - 15, rec.br().y - rec.height / 2); Point centerw = new Point(rec.br().x - rec.width / 2 - 15, rec.br().y - rec.height / 2 - 20); - // Imgproc.putText(matOriginal, "hello" + (int) distance, - // center, - // Core.FONT_HERSHEY_PLAIN, 20, BLACK); - // Imgproc.putText(matOriginal, "hello2" + (int) azimuth, - // centerw, - // Core.FONT_HERSHEY_PLAIN, 20, BLACK); + Imgproc.putText(matOriginal, "hello" + (int) distance, center, Core.FONT_HERSHEY_PLAIN, 20, BLACK); + Imgproc.putText(matOriginal, "hello2" + (int) azimuth, centerw, Core.FONT_HERSHEY_PLAIN, 20, BLACK); System.out.println(distance + "m, " + azimuth + " degrees " + center.x + ", " + center.y); } FrameCount++; - Imgcodecs.imwrite("output.png", matThresh); + // Imgcodecs.imwrite("output.png", matThresh); } shouldRun = false; } diff --git a/ShowImage.java b/ShowImage.java index 91c3072..8a0adc7 100644 --- a/ShowImage.java +++ b/ShowImage.java @@ -9,51 +9,51 @@ import javax.imageio.ImageIO; import javax.swing.JFrame; public class ShowImage extends Panel { - BufferedImage image; - - public ShowImage() { - try { - // image file - // name is - // test.png - URL input = this.getClass().getResource(("test.png")); - // this will read the image to save - // into a BufferedImage variable - image = ImageIO.read(input); - } catch (IOException ie) { - // this is to spill - // out a message - // saying - // something - // doesn't work - System.out.println("Error: " + ie.getMessage()); - } - } - - public void paint(Graphics g) { - // This is to actually draw the image out, - // necessary. - - // Input of a bufferedimage, x, y, then - // an observer in this case null. - g.drawImage(image, 0, 0, null); - } - - static public void main(String args[]) throws Exception { - // Creates a window to - // display the image - JFrame frame = new JFrame("Display image"); - - // Gets the image from ShowImage() method - Panel panel = new ShowImage(); - - // Adds the image to the new window - // panel - frame.getContentPane().add(panel); - - // sets the size of the panel - frame.setSize(500, 500); - // makes it visible - frame.setVisible(true); - } + BufferedImage image; + + public ShowImage() { + try { + // image file + // name is + // test.png + URL input = this.getClass().getResource(("imgs/test.png")); + // this will read the image to save + // into a BufferedImage variable + image = ImageIO.read(input); + } catch (IOException ie) { + // this is to spill + // out a message + // saying + // something + // doesn't work + System.out.println("Error: " + ie.getMessage()); + } + } + + public void paint(Graphics g) { + // This is to actually draw the image out, + // necessary. + + // Input of a bufferedimage, x, y, then + // an observer in this case null. + g.drawImage(image, 0, 0, null); + } + + static public void main(String args[]) throws Exception { + // Creates a window to + // display the image + JFrame frame = new JFrame("Display image"); + + // Gets the image from ShowImage() method + Panel panel = new ShowImage(); + + // Adds the image to the new window + // panel + frame.getContentPane().add(panel); + + // sets the size of the panel + frame.setSize(500, 500); + // makes it visible + frame.setVisible(true); + } } diff --git a/imgs/test.png b/imgs/test.png deleted file mode 100644 index e679e12..0000000 Binary files a/imgs/test.png and /dev/null differ diff --git a/imgs/testpicture.png b/imgs/testpicture.png new file mode 100644 index 0000000..46ba1cb Binary files /dev/null and b/imgs/testpicture.png differ diff --git a/lib/opencv-310.jar b/lib/opencv-310.jar deleted file mode 100644 index 86c14b0..0000000 Binary files a/lib/opencv-310.jar and /dev/null differ