-
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.
- Loading branch information
Showing
18 changed files
with
345 additions
and
75 deletions.
There are no files selected for viewing
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
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
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
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
45 changes: 45 additions & 0 deletions
45
webcam-capture/src/main/java/com/github/sarxos/webcam/util/jh/JHNormalizeFilter.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,45 @@ | ||
package com.github.sarxos.webcam.util.jh; | ||
|
||
import static com.github.sarxos.webcam.util.ImageUtils.clamp; | ||
|
||
import java.awt.image.BufferedImage; | ||
|
||
|
||
public class JHNormalizeFilter extends JHFilter { | ||
|
||
@Override | ||
public BufferedImage filter(BufferedImage src, BufferedImage dest) { | ||
|
||
final int w = src.getWidth(); | ||
final int h = src.getHeight(); | ||
|
||
int c, a, r, g, b, i, max = 1; | ||
|
||
for (int x = 0; x < w; x++) { | ||
for (int y = 0; y < h; y++) { | ||
|
||
c = src.getRGB(x, y); | ||
a = clamp((c >> 24) & 0xff); | ||
r = clamp((c >> 16) & 0xff); | ||
g = clamp((c >> 8) & 0xff); | ||
b = clamp(c & 0xff); | ||
i = (a << 24) | (r << 16) | (g << 8) | b; | ||
|
||
if (i > max) { | ||
max = i; | ||
} | ||
} | ||
} | ||
|
||
for (int x = 0; x < w; x++) { | ||
for (int y = 0; y < h; y++) { | ||
c = src.getRGB(x, y); | ||
i = c * 256 / max; | ||
dest.setRGB(x, y, i); | ||
} | ||
} | ||
|
||
return dest; | ||
} | ||
|
||
} |
Oops, something went wrong.
db8a4c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I want to create a desktop appliaction using Java wich can scan a Qrcode with a webcam.
I am only a beginer so please guide me step by step
db8a4c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tinaket
Take a look at this video series for beginners by Genuine Coder:
https://github.com/sarxos/webcam-capture#youtube-tutorials
Take care!
db8a4c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.