Skip to content

Commit

Permalink
Remove Maven build warnings, fixes #72
Browse files Browse the repository at this point in the history
  • Loading branch information
sarxos committed Mar 18, 2013
1 parent dcfb905 commit 1dd0c96
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<dependency>
<groupId>org.openimaj</groupId>
<artifactId>core-video-capture</artifactId>
<version>1.0.6-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<exclusions>
<!-- webcam-capture doesn't need most of the transitive dependencies -->
<exclusion>
Expand Down
13 changes: 10 additions & 3 deletions webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public boolean open() {
* returned. User should use {@link #isImageNew()} method to distinguish if
* returned image is not the same as the previous one.
*
* @param asynchronous true for non-blocking mode, false for blocking
* @param async true for non-blocking mode, false for blocking
*/
public boolean open(boolean async) {

Expand Down Expand Up @@ -280,7 +280,7 @@ public Dimension getViewSize() {
* Return list of supported view sizes. It can differ between vary webcam
* data sources.
*
* @return
* @return Array of supported dimensions
*/
public Dimension[] getViewSizes() {
return device.getResolutions();
Expand Down Expand Up @@ -421,6 +421,13 @@ public BufferedImage getImage() {
}
}

public boolean isImageNew() {
if (asynchronous) {
return updater.isImageNew();
}
return true;
}

protected double getFPS() {
if (asynchronous) {
return updater.getFPS();
Expand Down Expand Up @@ -701,7 +708,7 @@ public static synchronized void setDriver(WebcamDriver driver) {
* <br>
* <b>This method is not thread-safe!</b>
*
* @param driver new video driver class to use
* @param driverClass new video driver class to use
* @throws IllegalArgumentException when argument is null
*/
public static synchronized void setDriver(Class<? extends WebcamDriver> driverClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface WebcamDiscoverySupport {
* devices registry not responding, etc). In general this method should
* return true.
*
* @return
* @return True if scan possible, false otherwise
*/
boolean isScanPossible();
}
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public void setFPSDisplayed(boolean displayed) {
/**
* Is webcam starting.
*
* @return
* @return True if panel is starting
*/
public boolean isStarting() {
return starting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public WebcamDevice getDevice() {
/**
* Process task by processor thread.
*
* @param processor the processor to be used to process this task
* @throws InterruptedException when thread has been interrupted
*/
public void process() throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public void run() {
*/
private volatile boolean running = false;

private volatile boolean imageNew = false;

/**
* Construct new webcam updater.
*
Expand Down Expand Up @@ -157,6 +159,8 @@ public void run() {
image.set(new WebcamReadImageTask(Webcam.getDriver(), webcam.getDevice()).getImage());
t2 = System.currentTimeMillis();

imageNew = true;

// Calculate delay required to achieve target FPS. In some cases it can
// be less than 0 because camera is not able to serve images as fast as
// we would like to. In such case just run with no delay, so maximum FPS
Expand Down Expand Up @@ -199,7 +203,7 @@ protected void notifyWebcamImageObtained(Webcam webcam, BufferedImage image) {
* method will block until webcam return first image. Maximum blocking time
* will be 10 seconds, after this time method will return null.
*
* @return
* @return Image stored in cache
*/
public BufferedImage getImage() {

Expand All @@ -223,9 +227,15 @@ public BufferedImage getImage() {
}
}

imageNew = false;

return image.get();
}

protected boolean isImageNew() {
return imageNew;
}

/**
* Return current FPS number. It is calculated in real-time on the base of
* how often camera serve new image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ public static void blurFractional(int[] in, int[] out, int width, int height, fl
}

/**
* Set the horizontal size of the blur.
* Set the horizontal size of the blur. Minimum hRadius value is 0.
*
* @param hRadius the radius of the blur in the horizontal direction
* @min-value 0
* @see #getHRadius
*/
public void setHRadius(float hRadius) {
Expand All @@ -217,10 +216,9 @@ public float getHRadius() {
}

/**
* Set the vertical size of the blur.
* Set the vertical size of the blur. Minimal vRadius value is 0.
*
* @param vRadius the radius of the blur in the vertical direction
* @min-value 0
* @see #getVRadius
*/
public void setVRadius(float vRadius) {
Expand All @@ -238,10 +236,10 @@ public float getVRadius() {
}

/**
* Set both the horizontal and vertical sizes of the blur.
* Set both the horizontal and vertical sizes of the blur. Minimum value is
* 0.
*
* @param radius the radius of the blur in both directions
* @min-value 0
* @see #getRadius
*/
public void setRadius(float radius) {
Expand All @@ -259,10 +257,9 @@ public float getRadius() {
}

/**
* Set the number of iterations the blur is performed.
* Set the number of iterations the blur is performed. Minimum value is 0.
*
* @param iterations the number of iterations
* @min-value 0
* @see #getIterations
*/
public void setIterations(int iterations) {
Expand Down

0 comments on commit 1dd0c96

Please sign in to comment.