Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQdx and the use of Python wrapper pynivison

Solved!
Go to solution

Hello -  I have a NI PCIe 1427 frame grabber with IMAQdx installed.  NI MAX sees the frame grabber and I can snap or grab images fine from the camera I'm using, a Xenics Bobcat 320.  I need to use python 3.5 to grab images from the frame grabber and I found a python wrapper, pynivision:  https://github.com/robotpy/pynivision

When I try to opening the camera using:  IMAQdxOpenCamera I keep getting a error:  ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

 

I'm not a newbi to Labview and Machine Vision but am a newbie to python.  Has anyone successfully used pynivision?  

 

This is the simple example I'm running:

 

import core as nivision
import sys
name = "img0"

id = nivision.IMAQdxOpenCamera(name, nivision.IMAQdxCameraControlModeController)
pic = nivision.IMAQdxGrab(id)
closeCam = nivision.IMAQdxCloseCamera(name)

 import core is part of the pyniwrapper that defines all the IMAQ functions.

 

Thank you for any help.

0 Kudos
Message 1 of 5
(4,065 Views)
Solution
Accepted by topic author hwGuy

The 1427 uses IMAQ, not IMAQdx, and thus will not work with that Python wrapper.

0 Kudos
Message 2 of 5
(4,024 Views)

Thanks BlueCheese, big oversite on my part.  Now back to the drawing board.  I'm guessing just removing the 'dx' in the api won't work with IMAQ.

0 Kudos
Message 3 of 5
(4,012 Views)

Did you finally solved this issue?

 

 

I am trying to connect also a NI frame gabber(1433) with Python but i guess it is also IMAQ

0 Kudos
Message 4 of 5
(2,893 Views)

You need to convert your string into a ctype. You can see by typing

 

print(nivision.IMAQdxOpenCamera.argtypes)

that the first argument needs to be a ctype. 

 

Try:

 

name = ctypes.c_char_p(name.encode('utf-8'))

0 Kudos
Message 5 of 5
(2,275 Views)