Esempio n. 1
0
import MVGigE 
import time
import datetime
import cv2
import numpy as np
CAP_TIME = 30

open_state, cam = MVGigE.open(0)

if open_state == True:
	#MVGigE.set(cam, MVGigE.MVCAM_PROP_PACKET_DELAY, 5000);
	MVGigE.set(cam, MVGigE.MVCAM_PROP_PACKET_SIZE, 8996);	
	MVGigE.set(cam, MVGigE.MVCAM_PROP_EXPOSURE, 2000);
	MVGigE.set(cam, MVGigE.MVCAM_PROP_TRIG_MODE, MVGigE.TriggerMode_Off);
	
	w = MVGigE.get(cam, MVGigE.MVCAM_PROP_WIDTH)
	h = MVGigE.get(cam, MVGigE.MVCAM_PROP_HEIGHT)
	pixel_format = MVGigE.get(cam, MVGigE.MVCAM_PROP_PIXELFORMAT)
	rgb_image = np.zeros((h, w, 3), np.uint8)
	print('w %d; h %d;' % (w, h))

	if(MVGigE.start(cam)):
		frames = 0
		start_time = datetime.datetime.now()
	
		while(1):
			MVGigE.TriggerSoftware(cam)
			
			while 1:
				read_state, image = MVGigE.read(cam)
				if read_state == True:
Esempio n. 2
0
    capture_time = 10  #
    #print('times: ', sys.argv[1])
    cam_numbers = MVGigE.GetNumOfCameras()
    print("CamMum = %d" % cam_numbers)

    threads = []
    cam_handles = []
    cam_handles_tmp = []
    threads_tmp = []

    for index in range(cam_numbers):
        thread = -1
        open_state, cam_handle = MVGigE.open(index)
        if open_state:
            cam_set_para(cam_handle)
            pixel_format = MVGigE.get(cam_handle,
                                      MVGigE.MVCAM_PROP_PIXELFORMAT)
            thread = Capture_Thread(thread_fun, [cam_handle, pixel_format])
            thread.start()
            cam_handles_tmp.append(cam_handle)
            threads_tmp.append(thread)
        else:
            if cam_handle == MVGigE.MVST_ERROR:
                print("open error")
            elif cam_handle == MVGigE.MVST_INVALID_PARAMETER:
                print("incalied parameter")
            elif cam_handle == MVGigE.MVST_ACCESS_DENIED:
                print("access denied")
            elif cam_handle == MVGigE.MVST_INVALID_ID:
                print("invalid id")
            else:
                print("other error [%d]" % cam_handle)