Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

[SpectatorView] Calibration always fails

doris4730doris4730
edited February 2017 in Questions And Answers

I have tried to calibrate my camera and HoloLens with Calibration.sln using Visual Studio 2015 Update 3
I have downloaded the whole HoloLensCompanionKit-master from GitHub, change dependencies.props and stdafx.h. Calibrations app starts, it make some photos with chess board, but when I press enter trying to create CalibrationData.txt CalibrationApp always fails on line 383 of CalibrationApp.cpp:

// Calibrate the individual cameras.
    cv::Mat distCoeffColor, distCoeffHolo;
    cv::Mat colorR, holoR, colorT, holoT;

    cv::Mat colorMat = cv::initCameraMatrix2D(colorObjectPoints, colorImagePoints, cv::Size(HOLO_WIDTH, HOLO_HEIGHT), (double)HOLO_HEIGHT / (double)HOLO_WIDTH);
   ==> cv::Mat holoMat = cv::initCameraMatrix2D(holoObjectPoints, holoImagePoints, cv::Size(HOLO_WIDTH, HOLO_HEIGHT), (double)HOLO_HEIGHT / (double)HOLO_WIDTH);

Finally Calibration project crashes with error "opencv_world310.pdb contains development information, necessary to find the source code of opencv_world310.dll"

How i can fix this?

My files:

dependencies.props:

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros">
    <!-- From: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.1.0/opencv-3.1.0.exe/download -->
    <OpenCV_vc14>C:\opencv\build\x64\vc14</OpenCV_vc14>
    <!-- From: https://www.blackmagicdesign.com/support -->
    <DeckLink_inc>C:\Blackmagic\Blackmagic DeckLink SDK 10.8.3\Win\include</DeckLink_inc>
    <!-- From: https://github.com/elgatosf/gamecapture -->
    <Elgato_Filter>C:\Users\HoloGroup\Documents\GitHub\gamecapture\VideoCaptureFilter</Elgato_Filter>
  </PropertyGroup>
  <PropertyGroup />
  <ItemDefinitionGroup /> 
  <ItemGroup />
</Project>

stdafx.h:

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#pragma once

#define CHESS_SQUARE_SIZE 0.0677 // Width of the chess squares in meters = 2.66 inches.
// Note: must have > 3 columns and rows.
#define GRID_CELLS_X 6 // Number of columns in the chess board.
#define GRID_CELLS_Y 4 // Number of rows in the chess board.

// NOTE: If you change this to the HoloLens IP, you will need to:
//       1. Under the Security tab in the developer portal, disable SSL connection.
//       2. Use http://%DEVICE_IP%/ - do not use https://
#define HOLOLENS_ADDRESS L"http://127.0.0.1:10080/"
#define HOLOLENS_USER L"Hologroup"
#define HOLOLENS_PW L"Holo123456"

// Color feed from Hololens.
#define HOLO_WIDTH 1408
#define HOLO_HEIGHT 792
#define HOLO_BPP 4     // RGBA
#define HOLO_BUFSIZE (HOLO_WIDTH * HOLO_HEIGHT * HOLO_BPP)

#define CALIBRATION_FREQUENCY_SECONDS 3

// Use the C++ standard templated min/max
#define NOMINMAX

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#include <wrl/client.h>

#include <d3d11_1.h>
#include <DirectXMath.h>
#include <DirectXColors.h>

#include <algorithm>
#include <exception>
#include <memory>
#include <stdexcept>

#include "Keyboard.h"
#include <ScreenGrab.h>
#include <wincodec.h>

#include <string>

#include "CompositorShared.h"

namespace Calibration
{
    namespace DX
    {
        // Helper class for COM exceptions
        class com_exception : public std::exception
        {
        public:
            com_exception(HRESULT hr) : result(hr) {}

            virtual const char* what() const override
            {
                static char s_str[64] = { 0 };
                sprintf_s(s_str, "Failure with HRESULT of %08X", result);
                return s_str;
            }

        private:
            HRESULT result;
        };

        // Helper utility converts D3D API failures into exceptions.
        inline void ThrowIfFailed(HRESULT hr)
        {
            if (FAILED(hr))
            {
                throw com_exception(hr);
            }
        }

        // Safe release for interfaces
        template<class Interface>
        inline void SafeRelease(Interface *& pInterfaceToRelease)
        {
            if (pInterfaceToRelease != NULL)
            {
                pInterfaceToRelease->Release();
                pInterfaceToRelease = NULL;
            }
        }
    }
}

Best Answer

  • JacksonJackson mod
    Answer ✓

    Do you have images for both your camera and your HoloLens in "Documents\CalibrationFiles"? You should see matching pairs of files #_cam and #_holo. Ensure that you have at least 1 pair where the entire checkerboard is visible.

    Note: when you relaunch the calibration sln, all of your files get copied to "Documents\OldCalibrationFiles" - After you launch, you can copy them back to CalibrationFiles if you want to recalibrate with the same files.

    You can also put a breakpoint on line 382 and verify colorObjectPoints, colorImagePoints, holoObjectPoints, and holoImagePoints all have at least 1 element.

Answers

  • JacksonJackson mod
    Answer ✓

    Do you have images for both your camera and your HoloLens in "Documents\CalibrationFiles"? You should see matching pairs of files #_cam and #_holo. Ensure that you have at least 1 pair where the entire checkerboard is visible.

    Note: when you relaunch the calibration sln, all of your files get copied to "Documents\OldCalibrationFiles" - After you launch, you can copy them back to CalibrationFiles if you want to recalibrate with the same files.

    You can also put a breakpoint on line 382 and verify colorObjectPoints, colorImagePoints, holoObjectPoints, and holoImagePoints all have at least 1 element.

  • Finally I figured out what I done wrong, I found a silly mistake in stdafx.h file, that was wrong user login or pass, сonsequently I had only photo from cam.
    For now I calibrated it in proper way, thank you a lot :)

Sign In or Register to comment.