I am in the process of creating a program that will show a webcam on a JPanel and while the webcam is running, draw a rectangle over a part of it then store that in a Buffered Image.
Ideally my plan would be to use a mouse to draw the rectangle over it then store that part straight away once the rectangle has been drawn.
Is there a simple way of achieving this and if so how can I go about this?
Following is the code to display the webcam.
WebcamPanel panel = new WebcamPanel(webcam);
panel.setFPSDisplayed(true);
panel.setDisplayDebugInfo(true);
panel.setImageSizeDisplayed(true);
panel.setMirrored(true);
panel.setFocusable(true);
JFrame window = new JFrame("Test webcam panel");
window.add(panel);
window.setResizable(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.pack();
window.setVisible(true);