-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add few assertions in the code, minor changes
- Loading branch information
Showing
6 changed files
with
132 additions
and
10 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
webcam-capture/src/example/java/com/github/sarxos/webcam/example/CalculateFPSExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.github.sarxos.webcam.example; | ||
|
||
import com.github.sarxos.webcam.Webcam; | ||
import com.github.sarxos.webcam.log.WebcamLogConfigurator; | ||
|
||
|
||
public class CalculateFPSExample { | ||
|
||
public static void main(String[] args) { | ||
|
||
WebcamLogConfigurator.configure("src/example/resources/logback.xml"); | ||
|
||
long t1 = 0; | ||
long t2 = 0; | ||
|
||
int p = 10; | ||
int r = 5; | ||
|
||
Webcam webcam = Webcam.getDefault(); | ||
|
||
for (int k = 0; k < p; k++) { | ||
|
||
webcam.open(); | ||
webcam.getImage(); | ||
|
||
t1 = System.currentTimeMillis(); | ||
for (int i = 0; ++i <= r; webcam.getImage()) { | ||
} | ||
t2 = System.currentTimeMillis(); | ||
|
||
System.out.println("FPS " + k + ": " + (1000 * r / (t2 - t1 + 1))); | ||
|
||
webcam.close(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.