示例#1
0
def main():
    # we need a QApplication, that runs our QT Gui Framework
    app = PyuEyeQtApp()

    # a basic qt window
    view = PyuEyeQtView()
    view.show()
    view.user_callback = process_image

    # camera class to simplify uEye API access
    cam = Camera()
    cam.init()
    cam.set_colormode(ueye.IS_CM_BGR8_PACKED)
    cam.set_aoi(0, 0, 640, 480)
    cam.alloc()
    cam.capture_video()

    # a thread that waits for new images and processes all connected views
    thread = FrameThread(cam, view)
    thread.start()

    # cleanup
    app.exit_connect(thread.stop)
    app.exec_()

    thread.stop()
    thread.join()

    cam.stop_video()
    cam.exit()
示例#2
0
def main(config_path="/home/oran/Pictures/Settings/default-camera-settings.ini"
         ):
    print(config_path)
    # we need a QApplication, that runs our QT Gui Framework
    app = PyuEyeQtApp()

    # a basic qt window
    view = PyuEyeQtView()
    view.resize(1920 / 1.5, 1080 / 1.5)
    view.show()
    #update_config_gain(update={'red': '0','green' : '0','blue':'0'},set=True)
    #update_config_exposure(update=70,set=True)
    # view.user_callback = adjust_manually
    view.user_callback = print_means
    # view.user_callback = adjust_manually
    # camera class to simplify uEye API access
    cam = Camera()
    cam.init()
    # cam.set
    cam.set_colormode(ueye.IS_CM_BGR8_PACKED)
    pParam = ueye.wchar_p()
    pParam.value = config_path
    ueye.is_ParameterSet(1, ueye.IS_PARAMETERSET_CMD_LOAD_FILE, pParam, 0)

    # cam.set(cv2.cv.CV_CAP_PROP_EXPOSURE, 10)

    # cam.__getattribute__('is_CameraStatus')
    # cam.__setattr__('GetCameraInfo',0)
    #cam.set_aoi(0,0, 1280, 1024)
    cam.set_aoi(0, 0, 4912, 3684)
    cam.alloc()
    cam.capture_video()
    ueye._is_GetError
    ueye.is_Exposure(1,
                     ueye.c_uint(1),
                     ueye.c_void_p(),
                     cbSizeOfParam=ueye.c_int(0))
    # ueye.IS_EXPOSURE_CMD_GET_FINE_INCREMENT_RANGE_MIN = 20
    # ueye.IS_EXPOSURE_CMD_GET_FINE_INCREMENT_RANGE_MAX = 21

    # a thread that waits for new images and processes all connected views
    thread = FrameThread(cam, view)
    thread.start()

    # update_config_gain()

    # cleanup
    app.exit_connect(thread.stop)
    app.exec_()

    thread.stop()
    thread.join()

    cam.stop_video()
    cam.exit()
示例#3
0
def main():

    # we need a QApplication, that runs our QT Gui Framework
    print 'a'
    app = PyuEyeQtApp()
    print 'b'
    # a basic qt window
    view = PyuEyeQtView()
    print 'c'
    view.show()
    print 'd'
    view.user_callback = process_image
    print 'e'
    # camera class to simplify uEye API access
    cam = Camera()
    print 'f'
    cam.init()
    cam.set_colormode(ueye.IS_CM_BGR8_PACKED)
    #cam.set_colormode(ueye.IS_CM_SENSOR_RAW8)
    #cam.set_aoi(0,0, 1280, 1024)
    cam.set_aoi(300, 300, 400, 400)
    #cam.set_aoi(500,500,900,900)
    print 'g'
    cam.alloc()
    print 'h'
    cam.capture_video()
    print 'i'
    # a thread that waits for new images and processes all connected views
    print 'j'
    thread = FrameThread(cam, view)
    print 'k'
    thread.start()

    print 'l'

    # cleanup
    app.exit_connect(thread.stop)
    print '1'
    app.exec_()
    print '2'
    thread.stop()
    print '3'
    thread.join()
    print '4'
    cam.stop_video()
    print '5'
    cam.exit()
    print '6'
示例#4
0
def main():
    # we need a QApplication, that runs our QT Gui Framework
    ##app = PyuEyeQtApp()

    # a basic qt window
    #view = PyuEyeQtView()
    #view.show()
    #view.user_callback = process_image

    # camera class to simplify uEye API access
    cam = Camera(1)
    cam.init()
    cam.set_colormode(ueye.IS_CM_BGR8_PACKED)

    #ret = cam.set_exposure(30.0)
    #ret = cam.set_LUT()
    #
    width, height = cam.get_size()
    x = 0
    y = 0
    ret = cam.set_aoi(x, y, width, height)
    cam.alloc(buffer_count=100)
    ret = cam.capture_video(True)  # start to capture;

    fourcc = cv2.VideoWriter_fourcc(*'XVID')
    out = cv2.VideoWriter('_output.avi', fourcc, 20.0, (width, height))

    # a thread that waits for new images and processes all connected views
    #thread = FrameThread(cam)
    #thread.start()
    running = True
    img_buffer = ImageBuffer()
    DATA = ImageData(cam.handle(), img_buffer)
    while (ret == 0) and running:
        #img_buffer = ImageBuffer()
        ret = ueye.is_WaitForNextImage(cam.handle(), 1000, img_buffer.mem_ptr,
                                       img_buffer.mem_id)
        #print(img_buffer.mem_id)
        if ret == ueye.IS_SUCCESS:
            #DATA = ImageData(cam.handle(), img_buffer)
            DATA.getdata(img_buffer)
            #print(DATA.array.shape)
            image = DATA.as_1d_image()
            DATA.unlock()
            # make a gray image
            #imag = cv2.cvtColor(image, cv2.COLOR_BGR)
            cv2.imshow("Simple_black", image)
            out.write(image)
            if cv2.waitKey(1) == 27:
                break
            #cv2.Mat(ImageData.array)

    # cleanup
    #app.exit_connect(thread.stop)
    #app.exec_()

    #thread.stop()
    #thread.join()

    cam.stop_video()
    cam.exit()
    cv2.destroyAllWindows()
    out.release()
示例#5
0
from pyueye import ueye
from pyueye_example_camera import Camera
from pyueye_example_utils import FrameThread
import cv2
import numpy as np

cam = Camera()
cam.init()
cam.set_colormode(ueye.IS_CM_BGR8_PACKED)
cam.set_aoi(0, 0, 1280, 1024)
cam.alloc()
cam.capture_video()

thread = FrameThread(cam, view)
thread.start()
'''
is_SetBinning
is_SetSubSampling
is_AOI
is_Exposure
is_SetFrameRate
is_EdgeEnhancement
is_Measure (blurriness detection)
is_CaptureVideo
is_ColorTemperature
'''