multi-camera-image-stitching
in
Contributed Library Questions
•
1 year ago
hello processing forum,
i have been using processing before to read out QR-codes. there is a wonderful sample by Daniel Shiffman that i have used as a base (
http://www.shiffman.net/p5/pqrcode/). he uses the zxing "zebra crossing" library (
http://code.google.com/p/zxing/). now, i want to build a QR-Code table with an active area of 100cm by 35cm.
to do this i set up four playstation3 cameras in line to cover a specified field of view. in processing, i m setting up the cameras as well, but apparently the zxing library can only detect QR-codes in one camera capture. thats why i m running the decode thread on each camera image -- i guess there is better ways to do this.
i m assuming, that the best way to work around this problem, is to stitch the four camera images together, and have the zxing decode this.
so, how do i stitch the camera images together?
other suggestions are greatly appreciated.
the code is attached.
please help
best regards universally :)
T
- import processing.video.*;
- import com.google.zxing.*;
- import java.awt.image.BufferedImage;
- Capture cam1; //Set up the camera
- Capture cam2; //Set up the camera
- Capture cam3; //Set up the camera
- Capture cam4; //Set up the camera
- com.google.zxing.Reader reader = new com.google.zxing.qrcode.QRCodeReader();
- String[] captureDevices;
- void setup() {
- size(1280, 240); // wich is 4x320
- println (Capture.list());
- cam1 = new Capture(this, 320, 240, 30);
- cam2 = new Capture(this, 320, 240, 30);
- cam3 = new Capture(this, 320, 240, 30);
- cam4 = new Capture(this, 320, 240, 30);
- }
- void draw() {
- // CAM 1
- if (cam1.available() == true) {
- cam1.read();
- image(cam1, 0, 0);
- try {
- // Now test to see if it has a QR code embedded in it
- LuminanceSource source = new BufferedImageLuminanceSource((BufferedImage)cam1.getImage());
- BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
- Result result = reader.decode(bitmap);
- //Once we get the results, we can do some display
- if (result.getText() != null) {
- println(result.getText());
- ResultPoint[] points = result.getResultPoints();
- //Draw some ellipses on at the control points
- for (int i = 0; i < points.length; i++) {
- fill(#ff8c00);
- ellipse(points[i].getX(), points[i].getY(), 20, 20);
- }
- }
- }
- catch (Exception e) {
- // println(e.toString());
- }
- }
- // CAM 2
- if (cam2.available() == true) {
- cam2.read();
- image(cam2, 320, 0);
- try {
- // Now test to see if it has a QR code embedded in it
- LuminanceSource source = new BufferedImageLuminanceSource((BufferedImage)cam2.getImage());
- BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
- Result result = reader.decode(bitmap);
- //Once we get the results, we can do some display
- if (result.getText() != null) {
- println(result.getText());
- ResultPoint[] points = result.getResultPoints();
- //Draw some ellipses on at the control points
- for (int i = 0; i < points.length; i++) {
- fill(#ff8c00);
- ellipse(points[i].getX(), points[i].getY(), 20, 20);
- }
- }
- }
- catch (Exception e) {
- // println(e.toString());
- }
- }
- // CAM 3
- if (cam3.available() == true) {
- cam3.read();
- image(cam3, 640, 0);
- try {
- // Now test to see if it has a QR code embedded in it
- LuminanceSource source = new BufferedImageLuminanceSource((BufferedImage)cam3.getImage());
- BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
- Result result = reader.decode(bitmap);
- //Once we get the results, we can do some display
- if (result.getText() != null) {
- println(result.getText());
- ResultPoint[] points = result.getResultPoints();
- //Draw some ellipses on at the control points
- for (int i = 0; i < points.length; i++) {
- fill(#ff8c00);
- ellipse(points[i].getX(), points[i].getY(), 20, 20);
- }
- }
- }
- catch (Exception e) {
- // println(e.toString());
- }
- }
- // CAM 4
- if (cam4.available() == true) {
- cam4.read();
- image(cam4, 960, 0);
- try {
- // Now test to see if it has a QR code embedded in it
- LuminanceSource source = new BufferedImageLuminanceSource((BufferedImage)cam4.getImage());
- BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
- Result result = reader.decode(bitmap);
- //Once we get the results, we can do some display
- if (result.getText() != null) {
- println(result.getText());
- ResultPoint[] points = result.getResultPoints();
- //Draw some ellipses on at the control points
- for (int i = 0; i < points.length; i++) {
- fill(#ff8c00);
- ellipse(points[i].getX(), points[i].getY(), 20, 20);
- }
- }
- }
- catch (Exception e) {
- // println(e.toString());
- }
- }
- }
1