open a camera in pylon

 

def test_open_device(self):
cam = pylon.InstantCamera()
self.assertFalse(cam.IsOpen())
cam = self.create_first()
cam.Open()
self.assertTrue(cam.IsOpen())
cam.Close()
self.assertFalse(cam.IsOpen())

def test_attach(self):

-----------------------------------------------------------------------

def test_attach(self):
cam = pylon.InstantCamera()
self.assertFalse(cam.IsPylonDeviceAttached())
dev = pylon.TlFactory.GetInstance().CreateFirstDevice(self.device_filter[0])
cam.Attach(dev)
cam.Open()
self.assertTrue(cam.IsPylonDeviceAttached())
cam.DetachDevice()
self.assertFalse(cam.IsPylonDeviceAttached())

def test_destroy_device(self):

------------------------------------------------------------------------

def test_params_set(self):

# Do not choose a high value (> 15) for priority since that would require
# admin privileges.
if platform == 'linux':
priority_for_test = 0
else:
priority_for_test = 15

camera = pylon.InstantCamera()
camera.MaxNumBuffer = 20
camera.MaxNumQueuedBuffer = 40
camera.MaxNumGrabResults = 700
camera.ChunkNodeMapsEnable = False
camera.StaticChunkNodeMapPoolSize = 1
camera.GrabCameraEvents = True
camera.MonitorModeActive = True
camera.InternalGrabEngineThreadPriorityOverride = True
camera.InternalGrabEngineThreadPriority = priority_for_test
camera.GrabLoopThreadUseTimeout = True
camera.GrabLoopThreadTimeout = 10000
camera.GrabLoopThreadPriorityOverride = True
camera.GrabLoopThreadPriority = priority_for_test
camera.OutputQueueSize = 10

self.assertEqual(20, camera.MaxNumBuffer.Value)
self.assertEqual(40, camera.MaxNumQueuedBuffer.Value)
self.assertEqual(700, camera.MaxNumGrabResults.Value)
self.assertFalse(camera.ChunkNodeMapsEnable.Value)
self.assertEqual(1, camera.StaticChunkNodeMapPoolSize.Value)
self.assertTrue(camera.GrabCameraEvents.Value)
self.assertTrue(camera.MonitorModeActive.Value)
self.assertTrue(camera.InternalGrabEngineThreadPriorityOverride.Value)
self.assertEqual(priority_for_test, camera.InternalGrabEngineThreadPriority.Value)
self.assertTrue(camera.GrabLoopThreadUseTimeout.Value)
self.assertEqual(10000, camera.GrabLoopThreadTimeout.Value)
self.assertTrue(camera.GrabLoopThreadPriorityOverride.Value)
self.assertEqual(priority_for_test, camera.GrabLoopThreadPriority.Value)
self.assertEqual(10, camera.OutputQueueSize.Value)

def test_variable_params(self):

 

posted @ 2024-01-10 21:29  fire909090  阅读(10)  评论(0编辑  收藏  举报