working with OpenCV-python and the aruco library for a tracking project.
The following error is thrown when using
rvecs,tvecs = aruco.estimatePoseSingleMarker(corners, 0.1765, cameraMatrix, distcoefs)
error:
AttributeError: 'module' object has no attribute 'estimatePoseSingleMarker
others work fine
aruco.Dictionary_get(aruco.Dict_6x6_250)
aruco.DetectParameters_create()
any idea why its throwing that error?
>>> cv2.__version__
'3.2.0-dev'
odroid#odroid:~$ python --version
Python 2.7.12
odroid#odroid:~$ uname -a
Linux odroid 3.10.104-126 #1 SMP PREEMPT Tue Nov 29 22:24:16 UTC 2016
armv7l armv7l armv7l GNU/Linux
edit: its in the help documentation
help(cv2.aruco)
Help on module cv2.aruco in cv2:
NAME
cv2.aruco
FILE
(built-in)
FUNCTIONS
estimatePoseSingleMarkers(...)
estimatePoseSingleMarkers(corners, markerLength, cameraMatrix,
distCoeffs[, rvecs[, tvecs[, _objPoints]]]) -> rvecs, tvecs,
_objPoints
the module is aruco.estimatePoseSingleMarkers with an s at the end
Related
When I run in 32 bit python,
import pyvisa
rm = pyvisa.ResourceManager()
I get this error:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyvisa\highlevel.py", line 3015, in new
visa_library = open_visa_library(visa_library)
File "C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyvisa\highlevel.py", line 2929, in open_visa_library
return cls(argument)
File "C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyvisa\highlevel.py", line 175, in new
raise OSError("Could not open VISA library:\n" + "\n".join(errs))
OSError: Could not open VISA library:
function 'viOpen' not found
Here is what I have tried so far:
re-installed with pip
$ pip install -U pyvisa
Here is some info of the install:
python -m visa info
C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\visa.py:13: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace import visa by import pyvisa as visa to achieve the same effect.
The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
warnings.warn
Machine Details:
Platform ID: Windows-10-10.0.18362-SP0
Processor: Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
Python:
Implementation: CPython
Executable: C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\python.exe
Version: 3.8.5
Compiler: MSC v.1926 32 bit (Intel)
Bits: 32bit
Build: Jul 20 2020 15:43:08 (#tags/v3.8.5:580fbb0)
Unicode: UCS4
PyVISA Version: 1.11.3
Backends:
ivi:
Version: 1.11.3 (bundled with PyVISA)
#1: C:\windows\system32\visa32.dll:
found by: auto
bitness: 32
Could not get more info:
function 'viOpen' not found
I am not sure what is going wrong here. From my research, it seems that the biggest 2 ways that people make mistakes are in mismatching a 32 version of pyvisa and a 64 bit version of IDLE (both of mine are 32 bit) and the other is in naming the file visa.py (which I am not doing).
Any help is greatly appreciated, cheers!
After some more digging, I found that this is a problem for python 3.8 as it does not load the DLL files correctly (something about an environmental PATH). In my specific case, I am interested in loading the keysight visa, so the below works for me.
import os
os.add_dll_directory('C:\\Program Files (x86)\\Keysight\\IO Libraries Suite\\bin')
import pyvisa
rm = pyvisa.ResourceManager('ktvisa32')
and now rm returns:
rm <enter>
<ResourceManager(<IVIVisaLibrary('ktvisa32')>)>
I think that this is the fix to my problem. However, I am running 'offline' right now and am not able to access the key-sight test equipment to see if I can talk to them over the python scripts. My fingers are crossed :)
Thanks for reading :)
NXP's NFC card reader PNEV512R (https://www.nxp.com/products/rfid-nfc/nfc-hf/nfc-readers/explore-nfc-exclusive-from-element14:PNEV512R) does not work with my new raspberry pi 4.
Kernel:
Linux AlexPi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux
Release:
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux" VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
For installing the needed software I followed this manual: https://github.com/svvitale/nxppy
Installation was without any fails. But even the instantiation of Mifare raises an exception.
Python Code:
import nxppy
mifare=nxppy.Mifare()
Exception:
nxppy.InitError: Nxppy: Unknown Error from Undefined Component
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "nfc.py", line 3, in <module>
mifare=nxppy.Mifare()
SystemError: <class 'nxppy.Mifare'> returned a result with an error set
The SPI was switched on of course. ^^ And I tested the interface with the loopbacktest: https://elinux.org/RPi_SPI
So SPI is working. On my Raspbarry Pi 3B+ everything works fine. Now I am looking for a solution to fix this problem.
I have an error while connecting my device using GPIB interface by PYvisa.Below is the simple code i run.
>>> import visa;
>>> rm = visa.ResourceManager('C:/Windows/System32/visa32.dll');
>>> rm.list_resources();
('ASRL10::INSTR', 'ASRL71::INSTR')
But i don't see them getting detected as GPIB interface themselves.(like GPIB::25::INSTR).I have installed proper version of python and PyVISA. Below is the output for the same.
C:\>python -c "from pyvisa import util; util.get_debug_info()"
Machine Details:
Platform ID: Windows-7-6.1.7600
Processor: x86 Family 6 Model 58 Stepping 9, GenuineIntel
Python:
Implementation: CPython
Executable: C:\Python34\python.exe
Version: 3.4.3
Compiler: MSC v.1600 32 bit (Intel)
Bits: 32bit
Build: Feb 24 2015 22:43:06 (#v3.4.3:9b73f1c3e601)
Unicode: UCS4
PyVISA Version: 1.8
Backends:
ni:
Version: 1.8 (bundled with PyVISA)
#1: C:\Windows\system32\visa32.dll:
found by: auto
bitness: 32
Vendor: National Instruments
Impl. Version: 14680064
Spec. Version: 5243904
#2: C:\Windows\system32\visa32.dll:
found by: auto
bitness: 32
Vendor: National Instruments
Impl. Version: 14680064
Spec. Version: 5243904
Googling, i found that version and library path may be the possible reasons. But i guess that is not the issue in my case. Can anyone point out where am i going wrong as i am very much new to Python and pyVISA.
Check if your GPIB devices connected/detected via the NIMax panel. If it does not show up on the NIMax then your devices are not connected.
Additionally you should not need to put the visa32.dll path in visa.ResourceManager().
import cv2
fgbg = cv2.createBackgroundSubtractorMOG()
fgbg1 = cv2.createBackgroundSubtractorGMG()
AttributeError: 'module' object has no attribute 'createBackgroundSubtractorMOG()'
AttributeError: 'module' object has no attribute 'createBackgroundSubtractorMOG()'
Enviroment:
x64 win7
win32 python 2.7.3
opencv 3.0.0-beta
What should I do?
You may be interested in BackgroundSubtractorMOG2, which, although not documented, has a python binding in opencv 3.0.0-beta.
import cv2
fgbg = cv2.createBackgroundSubtractorMOG2(detectShadows=True)
both were moved in 3.0 to the opencv_contrib repo
you will need to build it along with your main opencv repo using cmake. (no prebuild versions of this available) then running the INSTALL project (or make install) will copy your new cv2.pyd to the python folder.
then:
>>> import cv2
>>> cv2.bgsegm.createBackgroundSubtractorMOG # note additional bgsegm namespace !
<built-in function createBackgroundSubtractorMOG>
Use cv2.BackgroundSubtractorMOG()
because cv2.createBackgroundSubtractorMOG2 was replaced in the latest versions of opencv.
Try one of the following solutions:
cv2.bgsegm.createBackgroundSubtractorMOG()
or:
cv2.bgsegm.createBackgroundSubtractorMOG2()
I would like to run the NED query of the astroquery package.
from astroquery.ned import Ned
result_table = Ned.query_object("NGC 224")
this is given by the example in the Documentary.
I got the following issue:
TableParseError: Failed to parse NED result! The raw response can be found in
self.response, and the error in self.table_parse_error.
In self.table_parse_error I find:
AttributeError("'bytes' object has no attribute 'encode'")
I have no idea what has gone wrong.
Here are my versions:
Python 3.4.1 (default, May 19 2014, 17:23:49) [GCC 4.9.0 20140507 (prerelease)]
SciPy 0.14.0
Cython 0.20.1
OS posix [linux]
Numpy 1.8.1
IPython 2.1.0
This was raised as an issue on astroquery and is a confirmed bug:
https://github.com/astropy/astroquery/pull/343
it should be fixed shortly