qian256 / HoloLensARToolKit

Marker tracking using the front-facing camera of HoloLens (both 1 and 2) and Unity, with a wrapper of ARToolKit built for UWP (Windows Universal Platform)
GNU Lesser General Public License v3.0
349 stars 92 forks source link

Cube sample is not detected after calibration HoloLens2 #72

Closed szymek1 closed 2 years ago

szymek1 commented 2 years ago

Hello, I've recently made, with 37 images, the calibration for HoloLens2 camera. After that when I deploy my program which uses cube scene, there is no detection. The cube that should follow my real cube with tags on them just stays in one place. There are several suspicions of mine why it is like this:

  1. Conversion from OpenCV format to ARToolkit format: I think it is slightly unclear what does @qian256 mean when he says: "Modify the parameters in ARToolKitCalibrationFileGenerator.cpp using the results of previous calibration"(from instruction for calibration). The way I modified ARToolKitCalibrationFileGenerator.cpp is in main where I changed float[3][4] to float[3][3] as in my file from OpenCV there was no 4th column. I also replaced float dist[4] with float dist[5] as there was one more column to add. This modification made me to correct convParam function. I am not sure of this modification but as I said it wasn't clear for me jusy by reading teh instruction.

  2. I used 37 images, captured directly from HL2 and then I reshaped them to 1504x846 resolution but once again in ARToolKitCalibrationFileGenerator.cpp inside main function there is a condition that changes the rosolution whatsoever if xsize is not dividible by 64. Why is it like this? When ARToolKitCalibrationFileGenerator.cpp finishes its job it returns that xsize=1536, that makes very little sense to me as in unity we selelect 1504x846 resolution in ARUWP Controller.

I will very much appreciate any help!

szymek1 commented 2 years ago

I will answer by myself. It turned out that when the instruction says: "Modify the parameters in ARToolKitCalibrationFileGenerator.cpp using the results of previous calibration" it means to only update values of weights in float[3][4] and float dist[4], however for the first array [3][4] it means leaving the last column always to 0 and for dist[4] we have to add first 4 values from OpenCV calibration file(distortion parameters).