Calibrate works?
This commit is contained in:
parent
26e34f7671
commit
cc711c6343
1104 changed files with 636510 additions and 75 deletions
|
|
@ -0,0 +1,58 @@
|
|||
import gab.opencv.*;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.calib3d.StereoBM;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.calib3d.StereoSGBM;
|
||||
|
||||
OpenCV ocvL, ocvR;
|
||||
PImage imgL, imgR, depth1, depth2;
|
||||
|
||||
void setup() {
|
||||
|
||||
imgL = loadImage("scene_l.jpg");
|
||||
imgR = loadImage("scene_r.jpg");
|
||||
ocvL = new OpenCV(this, imgL);
|
||||
|
||||
ocvR = new OpenCV(this, imgR);
|
||||
|
||||
size(ocvL.width * 2, ocvL.height*2);
|
||||
|
||||
ocvL.gray();
|
||||
ocvR.gray();
|
||||
Mat left = ocvL.getGray();
|
||||
Mat right = ocvR.getGray();
|
||||
|
||||
Mat disparity = OpenCV.imitate(left);
|
||||
|
||||
StereoSGBM stereo = new StereoSGBM(0, 32, 3, 128, 256, 20, 16, 1, 100, 20, true);
|
||||
stereo.compute(left, right, disparity );
|
||||
|
||||
Mat depthMat = OpenCV.imitate(left);
|
||||
disparity.convertTo(depthMat, depthMat.type());
|
||||
|
||||
depth1 = createImage(depthMat.width(), depthMat.height(), RGB);
|
||||
ocvL.toPImage(depthMat, depth1);
|
||||
|
||||
StereoBM stereo2 = new StereoBM();
|
||||
stereo2.compute(left, right, disparity );
|
||||
disparity.convertTo(depthMat, depthMat.type());
|
||||
|
||||
|
||||
depth2 = createImage(depthMat.width(), depthMat.height(), RGB);
|
||||
ocvL.toPImage(depthMat, depth2);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
image(imgL, 0, 0);
|
||||
image(imgR, imgL.width, 0);
|
||||
|
||||
image(depth1, 0, imgL.height);
|
||||
image(depth2, imgL.width, imgL.height);
|
||||
|
||||
fill(255, 0, 0);
|
||||
text("left", 10, 20);
|
||||
text("right", 10 + imgL.width, 20);
|
||||
text("stereo SGBM", 10, imgL.height + 20);
|
||||
text("stereo BM", 10 + imgL.width, imgL.height+ 20);
|
||||
}
|
||||
|
||||
BIN
lib/opencv_processing/examples/DepthFromStereo/scene_l.jpg
Normal file
BIN
lib/opencv_processing/examples/DepthFromStereo/scene_l.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
BIN
lib/opencv_processing/examples/DepthFromStereo/scene_r.jpg
Normal file
BIN
lib/opencv_processing/examples/DepthFromStereo/scene_r.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Loading…
Add table
Add a link
Reference in a new issue