diff --git a/.gitignore b/.gitignore index b6e86ce0..08288e25 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ target **/*/.settings **/*/target **/*/dependency-reduced-pom.xml +pom.xml~ diff --git a/webcam-capture-examples/pom.xml b/webcam-capture-examples/pom.xml index a4e972ff..4491494b 100644 --- a/webcam-capture-examples/pom.xml +++ b/webcam-capture-examples/pom.xml @@ -6,7 +6,7 @@ com.github.sarxos webcam-capture-parent - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-examples @@ -25,6 +25,7 @@ webcam-capture-manycams webcam-capture-motiondetector webcam-capture-painter + webcam-capture-transformer webcam-capture-qrcode webcam-capture-swt-awt webcam-capture-video-recording diff --git a/webcam-capture-examples/webcam-capture-applet/pom.xml b/webcam-capture-examples/webcam-capture-applet/pom.xml index 0bf38ffe..70df7139 100644 --- a/webcam-capture-examples/webcam-capture-applet/pom.xml +++ b/webcam-capture-examples/webcam-capture-applet/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-applet diff --git a/webcam-capture-examples/webcam-capture-detect-face/pom.xml b/webcam-capture-examples/webcam-capture-detect-face/pom.xml index bc11afc3..4da304ae 100644 --- a/webcam-capture-examples/webcam-capture-detect-face/pom.xml +++ b/webcam-capture-examples/webcam-capture-detect-face/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-detect-face @@ -139,4 +139,4 @@ - \ No newline at end of file + diff --git a/webcam-capture-examples/webcam-capture-executable/pom.xml b/webcam-capture-examples/webcam-capture-executable/pom.xml index 0f3ce169..569304ad 100644 --- a/webcam-capture-examples/webcam-capture-executable/pom.xml +++ b/webcam-capture-examples/webcam-capture-executable/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-executable diff --git a/webcam-capture-examples/webcam-capture-javafx-fxml/pom.xml b/webcam-capture-examples/webcam-capture-javafx-fxml/pom.xml index 289a0366..657039ea 100644 --- a/webcam-capture-examples/webcam-capture-javafx-fxml/pom.xml +++ b/webcam-capture-examples/webcam-capture-javafx-fxml/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-javafx-fxml diff --git a/webcam-capture-examples/webcam-capture-javafx/pom.xml b/webcam-capture-examples/webcam-capture-javafx/pom.xml index 8bd65159..28b98cd4 100644 --- a/webcam-capture-examples/webcam-capture-javafx/pom.xml +++ b/webcam-capture-examples/webcam-capture-javafx/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-javafx diff --git a/webcam-capture-examples/webcam-capture-live-streaming/pom.xml b/webcam-capture-examples/webcam-capture-live-streaming/pom.xml index 0babad84..99b199d9 100644 --- a/webcam-capture-examples/webcam-capture-live-streaming/pom.xml +++ b/webcam-capture-examples/webcam-capture-live-streaming/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-live-streaming diff --git a/webcam-capture-examples/webcam-capture-manycams/pom.xml b/webcam-capture-examples/webcam-capture-manycams/pom.xml index 2acb10a3..1e83dcff 100644 --- a/webcam-capture-examples/webcam-capture-manycams/pom.xml +++ b/webcam-capture-examples/webcam-capture-manycams/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-manycams @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/webcam-capture-examples/webcam-capture-motiondetector/pom.xml b/webcam-capture-examples/webcam-capture-motiondetector/pom.xml index 4b35a451..6a2c45f9 100644 --- a/webcam-capture-examples/webcam-capture-motiondetector/pom.xml +++ b/webcam-capture-examples/webcam-capture-motiondetector/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-motiondetector @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/webcam-capture-examples/webcam-capture-onejar/pom.xml b/webcam-capture-examples/webcam-capture-onejar/pom.xml index 60a547ac..cc43323e 100644 --- a/webcam-capture-examples/webcam-capture-onejar/pom.xml +++ b/webcam-capture-examples/webcam-capture-onejar/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-onejar @@ -43,4 +43,4 @@ - \ No newline at end of file + diff --git a/webcam-capture-examples/webcam-capture-painter/pom.xml b/webcam-capture-examples/webcam-capture-painter/pom.xml index 02adc266..8b32b964 100644 --- a/webcam-capture-examples/webcam-capture-painter/pom.xml +++ b/webcam-capture-examples/webcam-capture-painter/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-painter @@ -33,4 +33,4 @@ - \ No newline at end of file + diff --git a/webcam-capture-examples/webcam-capture-qrcode/pom.xml b/webcam-capture-examples/webcam-capture-qrcode/pom.xml index 2dd008d1..1fa0574e 100644 --- a/webcam-capture-examples/webcam-capture-qrcode/pom.xml +++ b/webcam-capture-examples/webcam-capture-qrcode/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-qrcode @@ -27,4 +27,4 @@ - \ No newline at end of file + diff --git a/webcam-capture-examples/webcam-capture-swt-awt/pom.xml b/webcam-capture-examples/webcam-capture-swt-awt/pom.xml index 8b5111ef..346f02a4 100644 --- a/webcam-capture-examples/webcam-capture-swt-awt/pom.xml +++ b/webcam-capture-examples/webcam-capture-swt-awt/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-swt-awt diff --git a/webcam-capture-examples/webcam-capture-transformer/.classpath b/webcam-capture-examples/webcam-capture-transformer/.classpath new file mode 100644 index 00000000..979be421 --- /dev/null +++ b/webcam-capture-examples/webcam-capture-transformer/.classpath @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webcam-capture-examples/webcam-capture-transformer/.project b/webcam-capture-examples/webcam-capture-transformer/.project new file mode 100644 index 00000000..31667f0d --- /dev/null +++ b/webcam-capture-examples/webcam-capture-transformer/.project @@ -0,0 +1,23 @@ + + + webcam-capture-example-painter + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/webcam-capture-examples/webcam-capture-transformer/README.md b/webcam-capture-examples/webcam-capture-transformer/README.md new file mode 100644 index 00000000..c0b83341 --- /dev/null +++ b/webcam-capture-examples/webcam-capture-transformer/README.md @@ -0,0 +1,38 @@ +# Webcam Capture Custom Painter Example + +This simple example show how to use webcam image transformer feature. + +## What Is This + +This example presents how to use transformation feature to paint a frame on +the image. The goal of this simple application is to draw transparent frame +at the image from the camera video feed. The frame is created from the normal +PNG file with alpha channel. The inner part of the image is completely transparent. + +The frame image has been found on [pixabay.com](http://pixabay.com/) and can +be downloaded from [here](http://pixabay.com/pl/rozk%C5%82ad-jazdy-ramki-potw%C3%B3r-183669). +It's redistributed under Creative Commons Deed CC0 license. + +### Screenshoots: + +The frame only: + +![Frame](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-transformer/src/main/resources/frame.png "Frame") + +And how the application actually works: + +![Screenshoot](https://raw.github.com/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-transformer/src/etc/resources/screen.png "Screenshoot") + +## Frame Image License + +[Creative Commons Deed CC0](http://creativecommons.org/publicdomain/zero/1.0/) + +## Code License + +Copyright (C) 2014 Bartosz Firyn + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/webcam-capture-examples/webcam-capture-transformer/pom.xml b/webcam-capture-examples/webcam-capture-transformer/pom.xml new file mode 100644 index 00000000..25a38aa1 --- /dev/null +++ b/webcam-capture-examples/webcam-capture-transformer/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + + com.github.sarxos + webcam-capture-examples + 0.3.11-SNAPSHOT + + + webcam-capture-example-transformer + jar + + Webcam Capture - Image transformer Example + Example of how to use webcam image transformation feature + + + + com.github.sarxos + webcam-capture + ${project.version} + + + + \ No newline at end of file diff --git a/webcam-capture-examples/webcam-capture-transformer/src/etc/resources/screen.png b/webcam-capture-examples/webcam-capture-transformer/src/etc/resources/screen.png new file mode 100644 index 00000000..ab948309 Binary files /dev/null and b/webcam-capture-examples/webcam-capture-transformer/src/etc/resources/screen.png differ diff --git a/webcam-capture-examples/webcam-capture-transformer/src/main/java/com/github/sarxos/webcam/WebcamImageTransformerExample.java b/webcam-capture-examples/webcam-capture-transformer/src/main/java/com/github/sarxos/webcam/WebcamImageTransformerExample.java new file mode 100644 index 00000000..b7df4bf5 --- /dev/null +++ b/webcam-capture-examples/webcam-capture-transformer/src/main/java/com/github/sarxos/webcam/WebcamImageTransformerExample.java @@ -0,0 +1,86 @@ +package com.github.sarxos.webcam; + +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.IOException; + +import javax.imageio.ImageIO; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + + +/** + * Example demonstrating how to use webcam image transformer feature. + * + * @author Bartosz Firyn (SarXos) + */ +public class WebcamImageTransformerExample extends JFrame implements WebcamImageTransformer { + + private static final long serialVersionUID = 1L; + + private static final BufferedImage IMAGE_FRAME = getImage("frame.png"); + + public WebcamImageTransformerExample() { + + Webcam webcam = Webcam.getDefault(); + webcam.setViewSize(WebcamResolution.VGA.getSize()); + webcam.setImageTransformer(this); + webcam.open(); + + JFrame window = new JFrame("Test Transformer"); + + WebcamPanel panel = new WebcamPanel(webcam); + panel.setFPSDisplayed(true); + panel.setFillArea(true); + + window.add(panel); + window.pack(); + window.setVisible(true); + window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + @Override + public BufferedImage transform(BufferedImage image) { + + int w = image.getWidth(); + int h = image.getHeight(); + + BufferedImage modified = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); + + Graphics2D g2 = modified.createGraphics(); + g2.drawImage(image, null, 0, 0); + g2.drawImage(IMAGE_FRAME, null, 0, 0); + g2.dispose(); + + modified.flush(); + + return modified; + } + + private static final BufferedImage getImage(String image) { + try { + return ImageIO.read(WebcamImageTransformerExample.class.getResourceAsStream("/" + image)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static void main(String[] args) throws IOException { + + JFrame.setDefaultLookAndFeelDecorated(true); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + e.printStackTrace(); + } + new WebcamImageTransformerExample(); + } + }); + } +} diff --git a/webcam-capture-examples/webcam-capture-transformer/src/main/resources/frame.png b/webcam-capture-examples/webcam-capture-transformer/src/main/resources/frame.png new file mode 100644 index 00000000..8e7390af Binary files /dev/null and b/webcam-capture-examples/webcam-capture-transformer/src/main/resources/frame.png differ diff --git a/webcam-capture-examples/webcam-capture-video-recording/pom.xml b/webcam-capture-examples/webcam-capture-video-recording/pom.xml index e30043ea..fe364464 100644 --- a/webcam-capture-examples/webcam-capture-video-recording/pom.xml +++ b/webcam-capture-examples/webcam-capture-video-recording/pom.xml @@ -5,7 +5,7 @@ com.github.sarxos webcam-capture-examples - 0.3.10-SNAPSHOT + 0.3.11-SNAPSHOT webcam-capture-example-video-recordig diff --git a/webcam-capture/src/test/java/com/github/sarxos/webcam/WebcamTest.java b/webcam-capture/src/test/java/com/github/sarxos/webcam/WebcamStaticsTest.java similarity index 100% rename from webcam-capture/src/test/java/com/github/sarxos/webcam/WebcamTest.java rename to webcam-capture/src/test/java/com/github/sarxos/webcam/WebcamStaticsTest.java