Hello,
I am trying to calibrate my OAK device which is: OAK-D-S2. I followed the instructions in this link: https://docs.luxonis.com/projects/hardware/en/latest/pages/guides/calibration/

According to my case, I tried to run this command:
python calibrate.py -s 2.25 --board OAK-D-S2 -nx 13 -ny 7

but this error appeared:

import depthai_calibration.calibration_utils as calibUtils

ModuleNotFoundError: No module named 'depthai_calibration.calibration_utils'

I tried many solutions like:

  • installing this library: https://github.com/luxonis/depthai-calibration
  • trying to put this library in different paths
  • renaming the folder as it is named 'depthai-calibration', which is different from'depthai_calibration.calibration_utils'

All of them did not work, and this error is still appearing. Any help, please?

I'd recommend getting DepthAI from github and running it from there. That repo has the calibration repo as a submodule and works a treat. I used it myself recently that way, I'm not sure if calibration has been included in the released version on pypy yet which may be the problem you're having.

Another thing, you may need to specify the marker size as well as the square size if you're using your own charuco board. 🙂

15 days later

Still not working, any help, please?

I am getting this error when I am following the steps….

You need to add more detail when replying, which step were you following when that occurred and what have you already tried to troubleshoot the problem?

Ok.. I already have DepthAI SDK on the PC. I tried to run Calibration.py, but the first error appeared. Then I tried to follow the steps you mentioned in https://github.com/luxonis/depthai, and the second error occurred. It occurred when the requirements of DepthAI were in the installation process. Furthermore, I mentioned all the details and the ways that I have tried in the post above(including sizes).
Thanks

Cool, thanks. So there's a few routes you can take from the link I shared, I suspect you used this command that's listed for the one time installation?
sudo curl -fL https://docs.luxonis.com/install_dependencies.sh | bash

The only way I've done it is by cloning the repository and running the code that way:

git clone --recursive https://github.com/luxonis/depthai.git
cd depthai
python3 install_requirements.py

This should get and install all the packages you need, I think it gets them from Luxonis build server too so you won't have to build them yourself.

If you've already cloned the repo but the depthai-calibration folder is empty, try running this command in the depthai folder
git pull --recurse-submodules

Give these a go and let me know how you get on. Just to clarify too, I don't work for Luxonis, I've just been going through this myself recently and trying to help out. 🙂

    I tried this: git pull --recurse-submodules
    then it gave me this:

    One thing I really need to recommend is that you delete that folder and create one in your Documents folder. Running your own code from inside Windows\system32 can risk destroying your operating system. You don't need to have this repo anywhere special to use it so no need for admin privileges either. I'm an ex-Microsoft Develop Support Engineer so this is something I can recommend with confidence!

    I suspect you're running from an old commit of DepthAI to be honest, if you start again from scratch in your Documents folder you'll at least be in a known-good state to start with. I had problems like this too when I was getting started with DepthAI, the new calibration library does make it much easy to calibrate though so worth going through this to use it.

    Open a command prompt in Documents and run this, fingers crossed this time it'll be much easier.
    git clone --recursive https://github.com/luxonis/depthai.git

    Why are you wanting to calibrate your camera anyhow? It should have been done from the factory, are you having problems with it?

      17 days later

      kneave
      Hello,
      Firstly, thank you for your reply. The problem is that I am not getting accurate coordination(x,y,z). I thought recalibration may help in improving the accuracy. I did like you told me. then I am getting the same error.

        Can you run git log -n1 in that folder please?

        No idea if it will fix the issue with accuracy or not, it seems like you may want to ask about that in a separate thread though as if that's the actual issue you're trying to solve there may be an easier fix.

        Hi MhmdBarazi
        I think you had an older version of the depthai repo installed, then you manually changed the folders, now the new one is not working properly.

        Could you:

        1. Check with git status if the .git is initialized in the directory. The response should have the names of files changed/created/deleted. If you get fatal: not a git repository (or any of the parent directories): .git then it's not initialized correctly and you can delete the whole depthai dir.
        2. If git status worked as it should, run git pull. This will pull the latest version of the repo.
        3. git restore . to discard any changes you have made to the files.
        4. Run git submodule update --init --recursive
        5. Try running the calibration.py

        Hope this works.

        Thanks,
        Jaka