Commit c23dfcac authored by quanqing sun's avatar quanqing sun

update screenCameraInfo

parent ef890c67
...@@ -168,11 +168,14 @@ double ScreenCameraInfo::cameraSymmetricYFov() { ...@@ -168,11 +168,14 @@ double ScreenCameraInfo::cameraSymmetricYFov() {
cv::Size2i symmetricFrameSize = cameraSymmetricFrameSize(); cv::Size2i symmetricFrameSize = cameraSymmetricFrameSize();
return cve::rad2deg(2.0 * atan2(symmetricFrameSize.height / 2.0, cameraMatrix(1, 1))); return cve::rad2deg(2.0 * atan2(symmetricFrameSize.height / 2.0, cameraMatrix(1, 1)));
} }
cv::Size ScreenCameraInfo::currentDisplayResolution() {
return screenPhysicalResolution;
}
cv::Matx33d ScreenCameraInfo::transformationFromScreenToCamera() { cv::Matx33d ScreenCameraInfo::transformationFromScreenToCamera() {
return cv::Matx33d(-1, 0, 0, 0, -1, 0, 0, 0, 1); return cv::Matx33d(-1, 0, 0, 0, 1, 0, 0, 0, -1);
} }
double ScreenCameraInfo::currentDisplayRatio() { double ScreenCameraInfo::currentDisplayRatio() {
float currentDisplayMaxLength = frontCameraResolution.width > frontCameraResolution.height ? frontCameraResolution.width : frontCameraResolution.height; float currentDisplayMaxLength = currentDisplayResolution().width > currentDisplayResolution().height ? currentDisplayResolution().width : currentDisplayResolution().height;
float physicalDisplayMaxLength = screenPhysicalResolution.width > screenPhysicalResolution.height ? screenPhysicalResolution.width : screenPhysicalResolution.height; float physicalDisplayMaxLength = screenPhysicalResolution.width > screenPhysicalResolution.height ? screenPhysicalResolution.width : screenPhysicalResolution.height;
return 1.f * currentDisplayMaxLength / physicalDisplayMaxLength; return 1.f * currentDisplayMaxLength / physicalDisplayMaxLength;
} }
...@@ -185,7 +188,7 @@ cv::Point2d ScreenCameraInfo::frontCameraPixelInCurrentResolution() { ...@@ -185,7 +188,7 @@ cv::Point2d ScreenCameraInfo::frontCameraPixelInCurrentResolution() {
return equavalentPixelPointForFrontCamera*currentDisplayRatio; return equavalentPixelPointForFrontCamera*currentDisplayRatio;
} }
cv::Matx44d ScreenCameraInfo::transformFromFrontCameraFrameToSceneModelCenteredOnScreenCenter() { cv::Matx44d ScreenCameraInfo::transformFromFrontCameraFrameToSceneModelCenteredOnScreenCenter() {
cv::Vec2d screenCenterPixel = cv::Vec2d(frontCameraResolution.width, frontCameraResolution.height)*0.5; cv::Vec2d screenCenterPixel = cv::Vec2d(currentDisplayResolution().width, currentDisplayResolution().height)*0.5;
cv::Vec3d screenCenterInCameraFrame = frontCameraPointFromPixel(screenCenterPixel); cv::Vec3d screenCenterInCameraFrame = frontCameraPointFromPixel(screenCenterPixel);
return cve::matx::joinRotationMatAndTranslationVec(cv::Matx33d::eye(), screenCenterInCameraFrame)*cve::matx::joinRotationMatAndTranslationVec(cve::matx::rotationMatrixFromEulerAngles(0.0, 0.0, -CV_PI), cv::Vec3d(0, 0, 0)); return cve::matx::joinRotationMatAndTranslationVec(cv::Matx33d::eye(), screenCenterInCameraFrame)*cve::matx::joinRotationMatAndTranslationVec(cve::matx::rotationMatrixFromEulerAngles(0.0, 0.0, -CV_PI), cv::Vec3d(0, 0, 0));
} }
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
static std::string currentDeviceCode(); static std::string currentDeviceCode();
static ScreenCameraInfo & getCurrentDiviceInfo(); static ScreenCameraInfo & getCurrentDiviceInfo();
cv::Size currentDisplayResolution();
cv::Matx33d transformationFromScreenToCamera(); cv::Matx33d transformationFromScreenToCamera();
double currentDisplayRatio(); double currentDisplayRatio();
double currentDisplayPPI(); double currentDisplayPPI();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment