Python Aruco unresolved

Hi, I have python 3.8.8 on my windows computer and also installed opencv-contrib-python(opencv version: 4.5.2) . I can use cv2 and most of its functions within Visual Studio IDE.
However, when I want to import cv2.aruco, It gives me “unresolved”" error. When I use aruco methods, The compiler neither complains nor does it give any exception. But simply it does not evaluate any marker corners. I know the library contains the aruco items. Anybody has an idea why I am having this problem?

please, exact code and exact error msg, thank you

Hi,
This is the import section of my python file in the VS or VS Code IDE:
import numpy as np
import cv2
import cv2.aruco

on the “import cv2.aruco” line I get “unresolved import cv2.aruco” message. However, in the same python environment, when I send the command from the command line:
Python 3.8 (64-bit) interactive window [PTVS 16.10.21111.19-16.0]
Type $help for a list of commands.

import cv2.aruco

It does not complain.

that might not use the same environment / python than your cmdline. please check things like __version__ and cv2.getBuildInformation()

I assure you that it is the same environment because I open the terminal window from my IDE where I choose also the python version I use.
When I run the code file with:
print(cv2.version) I get 4.5.2 which is the same version that I get from the command line.
The setup was initially created on my laptop via anaconda(python 3.8.8).
I first saw the problem then.
Then I uninstalled opencv-contrib-python from that environment and reinstalled it again.
The problem did not go away.
I then installed another python independent of the anaconda one (version 3.9.6)
This time I have built and installed the OpenCV and Opencv-contrib packages from the source by CMake (pointing to python 3.9.6) and then Visual Studio 2019. Unfortunately I have the same problem with the new setup as well in the IDE. No other packages cause any problem but only aruco.

“unresolved” something? that’s an error from the IDE (vscode), nothing more.

run the code. if it runs, it’s good.

if only the IDE complains that it can’t do autocompletion for you, that’s an issue with your IDE.

Hi,
Thank you for the reply. When I run the project, I get no marker corners even though I am supposed to get some because input image has them. It looks as though the aruco functions do not return anything.

run your program under pdb, the python debugger.