本文整理汇总了Java中processing.core.PMatrix3D.invert方法的典型用法代码示例。如果您正苦于以下问题:Java PMatrix3D.invert方法的具体用法?Java PMatrix3D.invert怎么用?Java PMatrix3D.invert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.core.PMatrix3D
的用法示例。
在下文中一共展示了PMatrix3D.invert方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calibrateProjectorDepthCam
import processing.core.PMatrix3D; //导入方法依赖的package包/类
protected void calibrateProjectorDepthCam(ArrayList<CalibrationSnapshot> snapshots) {
PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get();
kinectExtr.invert();
PlaneCalibration planeCalibCam = computeAveragePlaneCam(snapshots);
planeCalibCam.flipNormal();
// identity - no external camera for ProCam calibration
PMatrix3D kinectCameraExtrinsics = new PMatrix3D();
// Depth -> Color calibration.
kinectCameraExtrinsics.set(kinectExtr);
HomographyCalibration homography = CalibrationExtrinsic.computeScreenPaperIntersection(projector, planeCalibCam, kinectCameraExtrinsics);
if (homography == HomographyCalibration.INVALID) {
System.err.println("No intersection");
return;
}
// TODO: not sure here... ?
movePlaneAlongOffset(planeCalibCam);
saveKinectPlaneCalibration(planeCalibCam, homography);
saveKinectCameraExtrinsics(kinectCameraExtrinsics);
}
示例2: calibrateDepthToExternalExtr
import processing.core.PMatrix3D; //导入方法依赖的package包/类
protected void calibrateDepthToExternalExtr(ArrayList<CalibrationSnapshot> snapshots) {
// Depth -> color extrinsics
PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get();
// color -> depth extrinsics
kinectExtr.invert();
// depth -> tracking
PMatrix3D kinectCameraExtr = computeKinectCamExtrinsics(snapshots, kinectExtr);
// // tracking -> depth
kinectCameraExtr.invert();
this.kinectCameraExtrinsics.set(kinectCameraExtr);
saveKinectCameraExtrinsics(kinectCameraExtr);
}
示例3: goTo
import processing.core.PMatrix3D; //导入方法依赖的package包/类
/**
* *
* Works only in 3D mode with beginDraw3D().
*
* @param paperScreen PaperScreen to go to.
*/
public void goTo(PaperScreen paperScreen) {
if (this.isDrawingOnScreen == true) {
throw new RuntimeException("Impossible to draw on another board. You need to draw using beginDraw3D() to do so.");
}
// if (this.currentGraphics != graphics) {
// throw new RuntimeException("The given graphics context is not valid. Use the one given by beginDraw3D().");
// }
// get the location of this board...
PMatrix3D loc = this.getLocation().get();
loc.invert();
loc.apply(paperScreen.getLocation());
applyMatrix(loc);
}
示例4: getCoordFrom
import processing.core.PMatrix3D; //导入方法依赖的package包/类
public PVector getCoordFrom(PaperScreen paperScreen, PVector point) {
// get a copy
PMatrix3D thisLocationInv = this.getLocation().get();
thisLocationInv.invert();
PMatrix3D otherLocation = paperScreen.getLocation();
PVector cameraViewOfPoint = new PVector();
otherLocation.mult(point, cameraViewOfPoint);
PVector thisViewOfPoint = new PVector();
thisLocationInv.mult(cameraViewOfPoint, thisViewOfPoint);
if (Float.isNaN(thisViewOfPoint.x)) {
return INVALID_VECTOR;
}
return thisViewOfPoint;
}
示例5: updateDepthCameraDeviceExtrinsics
import processing.core.PMatrix3D; //导入方法依赖的package包/类
private void updateDepthCameraDeviceExtrinsics(){
// Check if depthCamera is the same as the camera !
if (projector == null &&
cameraTracking instanceof CameraRGBIRDepth &&
cameraTracking == depthCameraDevice.getMainCamera()) {
// No extrinsic used, it is already in the camera...
depthCameraDevice.getDepthCamera().setExtrinsics(depthCameraDevice.getStereoCalibration());
// Specific
// Important to use it for now ! Used in KinectTouchInput.projectPointToScreen
((KinectTouchInput) this.touchInput).useRawDepth();
// System.out.println("Papart: Using Touchextrinsics from the device.");
} else {
// Two different cameras
// setExtrinsics must after the kinect stereo calibration is loaded
PMatrix3D extr = (Papart.getPapart()).loadCalibration(Papart.kinectTrackingCalib);
extr.invert();
depthCameraDevice.getDepthCamera().setExtrinsics(extr);
// System.out.println("Papart: Using Touchextrinsics from the calibrated File.");
}
}
示例6: calibrateDepthCamPlane
import processing.core.PMatrix3D; //导入方法依赖的package包/类
public boolean calibrateDepthCamPlane(ArrayList<CalibrationSnapshot> snapshots) {
// Depth -> color extrinsics
PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get();
// color -> depth extrinsics
kinectExtr.invert();
PlaneCalibration planeCalibCam = computeAveragePlaneCam(snapshots);
PlaneCalibration planeCalibKinect = computeAveragePlaneKinect(snapshots, kinectExtr);
planeCalibCam.flipNormal();
// Tracking --> depth
PMatrix3D kinectCameraExtr = papart.loadCalibration(Papart.kinectTrackingCalib);
HomographyCalibration homography = CalibrationExtrinsic.computeScreenPaperIntersection(projector,
planeCalibCam,
kinectCameraExtr);
if (homography == HomographyCalibration.INVALID) {
System.err.println("No intersection");
return false;
}
// move the plane up a little.
planeCalibKinect.flipNormal();
movePlaneAlongOffset(planeCalibKinect);
saveKinectPlaneCalibration(planeCalibKinect, homography);
return true;
}
示例7: calibrateDepthCamPlaneOnly
import processing.core.PMatrix3D; //导入方法依赖的package包/类
public boolean calibrateDepthCamPlaneOnly(ArrayList<CalibrationSnapshot> snapshots) {
// Depth -> color extrinsics
PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get();
// color -> depth extrinsics
kinectExtr.invert();
PlaneCalibration planeCalibCam = computeAveragePlaneCam(snapshots);
PlaneCalibration planeCalibKinect = computeAveragePlaneKinect(snapshots, kinectExtr);
planeCalibCam.flipNormal();
// Tracking --> depth
PMatrix3D kinectCameraExtr = papart.loadCalibration(Papart.kinectTrackingCalib);
HomographyCalibration homography = CalibrationExtrinsic.computeScreenPaperIntersection(projector,
planeCalibCam,
kinectCameraExtr);
if (homography == HomographyCalibration.INVALID) {
System.err.println("No intersection");
return false;
}
// move the plane up a little.
planeCalibKinect.flipNormal();
movePlaneAlongOffset(planeCalibKinect);
saveKinectPlaneCalibration(planeCalibKinect, homography);
return true;
}
示例8: computeExtrinsics
import processing.core.PMatrix3D; //导入方法依赖的package包/类
public static PMatrix3D computeExtrinsics(PMatrix3D camPaper, PMatrix3D projPaper) {
PMatrix3D extr = projPaper.get();
extr.invert();
extr.preApply(camPaper);
extr.invert();
return extr;
}
示例9: projectPointer
import processing.core.PMatrix3D; //导入方法依赖的package包/类
public PVector projectPointer(Screen screen, float x, float y) {
PMatrix3D screenMat = screen.getLocation(new PMatrix3D());
screenMat.invert();
PVector transformed = new PVector();
screenMat.mult(new PVector(x * drawingSizeX, y * drawingSizeY), transformed);
return transformed;
}
示例10: getTableLocationFromProjector
import processing.core.PMatrix3D; //导入方法依赖的package包/类
/**
* Use if the table location is relative to the projector.
*
* @return
*/
public PMatrix3D getTableLocationFromProjector() {
PMatrix3D extr = getProjectorDisplay().getExtrinsics();
extr.invert();
PMatrix3D table = getTableLocation();
table.preApply(extr);
return table;
}
示例11: initDraw
import processing.core.PMatrix3D; //导入方法依赖的package包/类
public void initDraw(Camera cam, PVector userPos, float nearPlane, float farPlane, boolean isAnaglyph, boolean isLeft, boolean isOnly) {
PGraphicsOpenGL graphics = getGraphics();
if (initPosM == null) {
this.isOpenGL = true;
// Transformation Camera -> Marker
initPosM = this.getLocation(cam);
initPosM.translate(this.getDrawSizeX() / 2, this.getDrawSizeY() / 2);
// All is relative to the paper's center. not the corner.
initPosM.scale(-1, 1, -1);
}
// get the current transformation...
PMatrix3D newPos = this.getLocation(cam);
newPos.translate(this.getDrawSizeX() / 2, this.getDrawSizeY() / 2);
newPos.scale(-1, 1, -1);
newPos.invert();
newPos.apply(initPosM);
PVector user = new PVector();
if (isAnaglyph && isLeft) {
userPos.add(-halfEyeDist * 2, 0, 0);
}
newPos.mult(userPos, user);
PVector paperCameraPos = user;
// Camera must look perpendicular to the screen.
graphics.camera(paperCameraPos.x, paperCameraPos.y, paperCameraPos.z,
paperCameraPos.x, paperCameraPos.y, 0,
0, 1, 0);
// http://www.gamedev.net/topic/597564-view-and-projection-matrices-for-vr-window-using-head-tracking/
float nearFactor = nearPlane / paperCameraPos.z;
float left = nearFactor * (-size.x / 2f - paperCameraPos.x);
float right = nearFactor * (size.x / 2f - paperCameraPos.x);
float top = nearFactor * (size.y / 2f - paperCameraPos.y);
float bottom = nearFactor * (-size.y / 2f - paperCameraPos.y);
graphics.frustum(left, right, bottom, top, nearPlane, farPlane);
graphics.projection.m11 = -graphics.projection.m11;
// No detection?
PMatrix3D transformation = this.getLocation(cam);
if (transformation.m03 == 0 && transformation.m13 == 0 && transformation.m23 == 0) {
resetPos();
}
}