67 static bool processedCalibResult =
false;
84 processedCalibResult =
false;
96 ss <<
"Click on the screen to create a calibration photo. Created "
108 s->
info(
"Busy extracting corners, please wait with grabbing ...");
115 s->
info(
"Calculating calibration, please wait ...");
119 if (!processedCalibResult)
123 processedCalibResult =
true;
127 string mainCalibFilename =
"camCalib_" + computerInfo +
"_main.xml";
128 string scndCalibFilename =
"camCalib_" + computerInfo +
"_scnd.xml";
133 #ifndef SL_EMSCRIPTEN
148 errorMsg +=
" Saving calibration failed!";
155 s->
info((
"Calibration failed!"));
161 s->
info((
"Capturing done!"));
166 log(
"SLProject", e.what());
167 s->
info(
"Exception during calibration! Please restart!");
190 if (!strF.empty() && !strW.empty() && !strH.empty())
192 float devF = strF.empty() ? 0.0f : stof(strF);
193 float devW = strW.empty() ? 0.0f : stof(strW);
194 float devH = strH.empty() ? 0.0f : stof(strH);
267 SLMat4f glOVM(cvOVM.val[0], cvOVM.val[1], cvOVM.val[2], cvOVM.val[3],
268 cvOVM.val[4], cvOVM.val[5], cvOVM.val[6], cvOVM.val[7],
269 cvOVM.val[8], cvOVM.val[9], cvOVM.val[10],cvOVM.val[11],
270 cvOVM.val[12],cvOVM.val[13],cvOVM.val[14],cvOVM.val[15]);
302 ss <<
"FOVH: " << fovH <<
", error: " << err;
304 ss <<
"Not calibrated. FOVH guessed: " << fovH <<
" degrees.";
323 undistorted.isContinuous(),
340 #ifndef SL_EMSCRIPTEN
The AppCommon class holds the top-level instances of the app-demo.
Definition of scene IDs in the demo app.
@ SID_VideoTrackChessScnd
@ SID_VideoTrackChessMain
bool onUpdateVideo()
Implements the update per frame for video update and feature tracking.
SLNode * gVideoTrackedNode
SLGLTexture * gVideoTexture
void ensureValidCalibration(CVCamera *ac, SLSceneView *sv)
logic that ensures that we have a valid calibration state
void updateTrackingSceneCamera(CVCamera *ac)
CVTracked * gVideoTracker
void runCalibrationEstimator(CVCamera *ac, SLScene *s, SLSceneView *sv)
@ CS_calibrated
The camera is calibrated.
@ CS_uncalibrated
The camera is not calibrated (no calibration found)
@ VT_NONE
No camera needed.
@ VT_MAIN
Main camera on all on all all devices.
#define PROFILE_FUNCTION()
#define SL_WARN_MSG(message)
#define SL_DB_HIDDEN
Flags an object as hidden.
static const string CALIB_FTP_HOST
ftp host for calibration up and download
static CVCalibrationEstimator * calibrationEstimator
static const string CALIB_FTP_USER
ftp login user for calibration up and download
static const string CALIB_FTP_DIR
ftp directory for calibration up and download
static SLstring calibIniPath
That's where data/calibrations folder is located.
static SLstring exePath
executable root path
static const string CALIB_FTP_PWD
ftp login pwd for calibration up and download
static SLVSceneView sceneViews
Vector of sceneview pointers.
static CVCalibrationEstimatorParams calibrationEstimatorParams
static SLstring externalPath
Default path for external file storage.
static SLSceneID sceneID
ID of currently loaded scene.
static SLScene * scene
Pointer to the one and only SLScene instance.
static map< string, string > deviceParameter
Generic device parameter.
static SLstring calibFilePath
That's where calibrations are stored and loaded from.
special exception that informs about errors during calibration process
CVCalibration getCalibration()
Get resulting calibration.
bool updateAndDecorate(CVMat imageColor, const CVMat &imageGray, bool grabFrame, bool drawCorners=true)
< Finds the inner chessboard corners in the given image
Live video camera calibration class with OpenCV an OpenCV calibration.
void remap(CVMat &inDistorted, CVMat &outUndistorted)
Undistorts the inDistorted image into the outUndistorted.
float reprojectionError() const
float cameraFovHDeg() const
float cameraFovVDeg() const
bool save(const string &calibDir, const string &calibFileName)
Saves the camera calibration parameters to the config file.
CVCalibState state() const
CVCalibration calibration
void showUndistorted(bool su)
CVCamera * activeCamera
Pointer to the active camera.
CVPixelFormatGL format
GL pixel format.
void videoType(CVVideoType vt)
Setter for video type also sets the active calibration.
CVMat lastFrame
last frame grabbed in BGR
static CVCapture * instance()
Public static instance getter for singleton pattern.
CVTracked is the pure virtual base class for tracking features in video.
static AvgFloat trackingTimesMS
Averaged time for video tracking in ms.
virtual bool track(CVMat imageGray, CVMat imageBgr, CVCalibration *calib)=0
CVMatx44f objectViewMat()
Active or visible camera node class.
void fov(const SLfloat fov)
vertical field of view
Texture object for OpenGL texturing.
SLbool copyVideoImage(SLint camWidth, SLint camHeight, CVPixelFormatGL glFormat, SLuchar *data, SLbool isContinuous, SLbool isTopLeft)
Copies the image data from a video camera into the current video image.
SLMat4< T > inverted() const
Computes the inverse of a 4x4 non-singular matrix.
SLNode represents a node in a hierarchical scene graph.
void om(const SLMat4f &mat)
void setDrawBitsRec(SLuint bit, SLbool state)
The SLScene class represents the top level instance holding the scene structure.
SceneView class represents a dynamic real time 3D view onto the scene.
void camera(SLCamera *camera)
void set(T value)
Sets the current value in the value array and builds the average.
bool uploadFile(const string &fileDir, const string &fileName, const string &ftpHost, const string &ftpUser, const string &ftpPwd, const string &ftpDir, string &errorMsg)
Uploads file to the ftp server.
void errorMsg(const char *tag, const char *msg, const int line, const char *file)
Platform independent error message output.
void log(const char *tag, const char *format,...)
logs a formatted string platform independently