diff options
| author | morefigs <morefigs@gmail.com> | 2019-01-30 13:59:23 +1100 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-01-30 13:59:23 +1100 |
| commit | 6d6fc471aceff5802fc3ad5db3d35521e87abf4c (patch) | |
| tree | 178006ebbf18452091e0caf4f73c313b9185ce32 | |
| parent | 01587d8ba4d5a1f8371f44e719eda6547d3ed459 (diff) | |
| download | pymba-6d6fc471aceff5802fc3ad5db3d35521e87abf4c.tar.gz pymba-6d6fc471aceff5802fc3ad5db3d35521e87abf4c.zip | |
delete outdates tests
| -rw-r--r-- | tests/opencv_example.py | 76 | ||||
| -rw-r--r-- | tests/opencv_liveview_example.py | 79 | ||||
| -rw-r--r-- | tests/opencv_liveview_example_color.py | 89 | ||||
| -rw-r--r-- | tests/test_cameras.py | 72 | ||||
| -rw-r--r-- | tests/test_enumfeature.py | 25 | ||||
| -rw-r--r-- | tests/test_installation.py | 9 | ||||
| -rw-r--r-- | tests/test_interfaces.py | 28 | ||||
| -rw-r--r-- | tests/test_systemfeature.py | 20 |
8 files changed, 0 insertions, 398 deletions
diff --git a/tests/opencv_example.py b/tests/opencv_example.py deleted file mode 100644 index edc6a5d..0000000 --- a/tests/opencv_example.py +++ /dev/null @@ -1,76 +0,0 @@ -from __future__ import absolute_import, print_function, division -from pymba import * -import numpy as np -import cv2 -import time - -#very crude example, assumes your camera is PixelMode = BAYERRG8 - -# start Vimba -with Vimba() as vimba: - # get system object - system = vimba.getSystem() - - # list available cameras (after enabling discovery for GigE cameras) - if system.GeVTLIsPresent: - system.run_feature_command("GeVDiscoveryAllOnce") - time.sleep(0.2) - cameraIds = vimba.getCameraIds() - for cameraId in cameraIds: - print('Camera ID:', cameraId) - - # get and open a camera - camera0 = vimba.getCamera(cameraIds[0]) - camera0.open() - - # list camera features - cameraFeatureNames = camera0.get_feature_names() - for name in cameraFeatureNames: - print('Camera feature:', name) - - # read info of a camera feature - #featureInfo = camera0.getFeatureInfo('AcquisitionMode') - #for field in featInfo.getFieldNames(): - # print field, '--', getattr(featInfo, field) - - # get the value of a feature - print(camera0.AcquisitionMode) - - # set the value of a feature - camera0.AcquisitionMode = 'SingleFrame' - - # create new frames for the camera - frame0 = camera0.create_frame() # creates a frame - frame1 = camera0.create_frame() # creates a second frame - - # announce frame - frame0.announce() - - # capture a camera image - count = 0 - while count < 10: - camera0.start_capture() - frame0.queue_capture() - camera0.run_feature_command('AcquisitionStart') - camera0.run_feature_command('AcquisitionStop') - frame0.wait_capture() - - # get image data... - imgData = frame0.get_buffer() - - moreUsefulImgData = np.ndarray(buffer = frame0.get_buffer(), - dtype = np.uint8, - shape = (frame0.height, - frame0.width, - 1)) - rgb = cv2.cvtColor(moreUsefulImgData, cv2.COLOR_BAYER_RG2RGB) - cv2.imwrite('foo{}.png'.format(count), rgb) - print("image {} saved".format(count)) - count += 1 - camera0.end_capture() - # clean up after capture - camera0.revoke_all_frames() - - # close camera - camera0.close() - diff --git a/tests/opencv_liveview_example.py b/tests/opencv_liveview_example.py deleted file mode 100644 index 9c83264..0000000 --- a/tests/opencv_liveview_example.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Mon Jul 07 14:59:03 2014 - -@author: derricw -""" - -from __future__ import absolute_import, print_function, division -from pymba import * -import numpy as np -import cv2 -import time - -cv2.namedWindow("test") - -with Vimba() as vimba: - system = vimba.getSystem() - - system.run_feature_command("GeVDiscoveryAllOnce") - time.sleep(0.2) - - camera_ids = vimba.getCameraIds() - - for cam_id in camera_ids: - print("Camera found: ", cam_id) - - c0 = vimba.getCamera(camera_ids[0]) - c0.open() - - try: - #gigE camera - print(c0.GevSCPSPacketSize) - print(c0.StreamBytesPerSecond) - c0.StreamBytesPerSecond = 100000000 - except: - #not a gigE camera - pass - - #set pixel format - c0.PixelFormat="Mono8" - #c0.ExposureTimeAbs=60000 - - frame = c0.create_frame() - frame.announce() - - c0.start_capture() - - framecount = 0 - droppedframes = [] - - while 1: - try: - frame.queue_capture() - success = True - except: - droppedframes.append(framecount) - success = False - c0.run_feature_command("AcquisitionStart") - c0.run_feature_command("AcquisitionStop") - frame.wait_capture(1000) - frame_data = frame.get_buffer() - if success: - img = np.ndarray(buffer=frame_data, - dtype=np.uint8, - shape=(frame.height,frame.width,1)) - cv2.imshow("test",img) - framecount+=1 - k = cv2.waitKey(1) - if k == 0x1b: - cv2.destroyAllWindows() - print("Frames displayed: %i"%framecount) - print("Frames dropped: %s"%droppedframes) - break - - - c0.end_capture() - c0.revoke_all_frames() - - c0.close() diff --git a/tests/opencv_liveview_example_color.py b/tests/opencv_liveview_example_color.py deleted file mode 100644 index e2e2379..0000000 --- a/tests/opencv_liveview_example_color.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Mon Jul 07 14:59:03 2014 - -@author: derricw - -Same as the other liveview example, but displays in color. - -Obviously you want to use a camera that has a color mode like BGR8Packed - -OpenCV is expecting color images to be in BGR8Packed by default. It can work - with other formats as well as convert one to the other, but this example - just uses its default behavior. - -""" -from __future__ import absolute_import, print_function, division -from pymba import * -import numpy as np -import cv2 -import time -import sys - -cv2.namedWindow("test") - -with Vimba() as vimba: - system = vimba.getSystem() - - system.run_feature_command("GeVDiscoveryAllOnce") - time.sleep(0.2) - - camera_ids = vimba.getCameraIds() - - for cam_id in camera_ids: - print("Camera found: ", cam_id) - - c0 = vimba.getCamera(camera_ids[0]) - c0.open() - - try: - #gigE camera - print("Packet size:", c0.GevSCPSPacketSize) - c0.StreamBytesPerSecond = 100000000 - print("BPS:", c0.StreamBytesPerSecond) - except: - #not a gigE camera - pass - - #set pixel format - c0.PixelFormat = "BGR8Packed" # OPENCV DEFAULT - time.sleep(0.2) - - frame = c0.create_frame() - frame.announce() - - c0.start_capture() - - framecount = 0 - droppedframes = [] - - while 1: - try: - frame.queue_capture() - success = True - except: - droppedframes.append(framecount) - success = False - c0.run_feature_command("AcquisitionStart") - c0.run_feature_command("AcquisitionStop") - frame.wait_capture(1000) - frame_data = frame.get_buffer() - if success: - img = np.ndarray(buffer=frame_data, - dtype=np.uint8, - shape=(frame.height, frame.width, frame.pixel_bytes)) - cv2.imshow("test", img) - framecount += 1 - k = cv2.waitKey(1) - if k == 0x1b: - cv2.destroyAllWindows() - print("Frames displayed: %i" % framecount) - print("Frames dropped: %s" % droppedframes) - break - - - c0.end_capture() - c0.revoke_all_frames() - - c0.close() - diff --git a/tests/test_cameras.py b/tests/test_cameras.py deleted file mode 100644 index 7879ce8..0000000 --- a/tests/test_cameras.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/python -from __future__ import absolute_import, print_function, division -from pymba import * -import time - - -def test_cameras(): - # start Vimba - with Vimba() as vimba: - # get system object - system = vimba.getSystem() - - # list available cameras (after enabling discovery for GigE cameras) - if system.GeVTLIsPresent: - system.run_feature_command("GeVDiscoveryAllOnce") - time.sleep(0.2) - - cameraIds = vimba.getCameraIds() - for cameraId in cameraIds: - print('Camera ID:', cameraId) - - # get and open a camera - camera0 = vimba.getCamera(cameraIds[0]) - camera0.open() - - # list camera features - cameraFeatureNames = camera0.get_feature_names() - for name in cameraFeatureNames: - print('Camera feature:', name) - - # get the value of a feature - print(camera0.AcquisitionMode) - - # set the value of a feature - camera0.AcquisitionMode = 'SingleFrame' - - # create new frames for the camera - frame0 = camera0.create_frame() # creates a frame - frame1 = camera0.create_frame() # creates a second frame - - # announce frame - frame0.announce() - - # capture a camera image - camera0.start_capture() - frame0.queue_capture() - camera0.run_feature_command('AcquisitionStart') - camera0.run_feature_command('AcquisitionStop') - frame0.wait_capture() - - # get image data... - imgData = frame0.get_buffer() - - # ...or use NumPy for fast image display (for use with OpenCV, etc) - import numpy as np - - moreUsefulImgData = np.ndarray(buffer=frame0.get_buffer(), - dtype=np.uint8, - shape=(frame0.height, - frame0.width, - 1)) - - # clean up after capture - camera0.end_capture() - camera0.revoke_all_frames() - - # close camera - camera0.close() - - -if __name__ == '__main__': - test_cameras()
\ No newline at end of file diff --git a/tests/test_enumfeature.py b/tests/test_enumfeature.py deleted file mode 100644 index 0744820..0000000 --- a/tests/test_enumfeature.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python -from __future__ import absolute_import, print_function, division -from pymba import * - - -def test_enumfeature(): - # get system object - with Vimba() as vimba: - system = vimba.getSystem() - - # get enum value - print ("get enum value (DiscoveryCameraEvent): '%s'" % (system.DiscoveryCameraEvent)) - - # get enum range - range = system.get_feature_range('DiscoveryCameraEvent') - print ("get enum value range (DiscoveryCameraEvent): '%s'" % (str(range))) - - # set enum value - #print ("setting enum value (DiscoveryCameraEvent)...") - #system.DiscoveryCameraEvent = 'Unreachable' - #print ("enum value (DiscoveryCameraEvent)set to '%s'." % (system.DiscoveryCameraEvent.value)) - - -if __name__ == '__main__': - test_enumfeature()
\ No newline at end of file diff --git a/tests/test_installation.py b/tests/test_installation.py deleted file mode 100644 index 06af7d6..0000000 --- a/tests/test_installation.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/python -from __future__ import absolute_import, print_function, division -from pymba import Vimba - - -def test_installation(): - with Vimba() as vimba: - version = vimba.getVersion() - assert version == '1.2.0' diff --git a/tests/test_interfaces.py b/tests/test_interfaces.py deleted file mode 100644 index 3fc4a94..0000000 --- a/tests/test_interfaces.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/python -from __future__ import absolute_import, print_function, division -from pymba import * -import time - - -def test_interfaces(): - # start Vimba - with Vimba() as vimba: - # get list of available interfaces - interfaceIds = vimba.getInterfaceIds() - for interfaceId in interfaceIds: - print('Interface ID:', interfaceId) - - # get interface object and open it - interface0 = vimba.getInterface(interfaceIds[0]) - interface0.open() - - # list interface features - interfaceFeatureNames = interface0.get_feature_names() - for name in interfaceFeatureNames: - print('Interface feature:', name) - - # close interface - interface0.close() - -if __name__ == '__main__': - test_interfaces()
\ No newline at end of file diff --git a/tests/test_systemfeature.py b/tests/test_systemfeature.py deleted file mode 100644 index f61d55d..0000000 --- a/tests/test_systemfeature.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python -from __future__ import absolute_import, print_function, division -from pymba import * - - -def test_systemfeature(): - # get system object - with Vimba() as vimba: - system = vimba.getSystem() - - # list system features - for featureName in system.get_feature_names(): - print('System feature:', featureName) - fInfo = system.get_feature_info(featureName) - for field in fInfo.getFieldNames(): - print("\t", featureName, ":", field, getattr(fInfo, field)) - - -if __name__ == '__main__': - test_systemfeature()
\ No newline at end of file |
