예제 #1
0
 def setHomographies(self, display = False):
 	'''
 	gets the best homography for all the images that are a part of the panorama
 	'''
     for j in range(len(self.panImages) - 1):
         imageOne = self.panImages[j].getNpImg()
         imageTwo = self.panImages[j+1].getNpImg()
         
         #Displays the image info if display is true
         if display == True:
         	imgutil.imageInfo(imageOne, "One")
         	imgutil.imageInfo(imageTwo, "Two")
         
         imageOne = self.panImages[j].getImg()
         imageTwo = self.panImages[j+1].getImg()
         
         #points from the second image are being warped to the first
         homography = self.automaticFeatures.getBestHomography(imageOne, imageTwo)
         self.removeSquares()
         
         self.homographies.append(homography)
         self.panImages[j + 1].setHomography(homography)
예제 #2
0
count = 0
span = 20
t0 = time.time()
key = None

# run a loop until the escape key is pressed
while key != 27:
    # grab a frame from the camera
    flag, frame = cam.read()
    
    # modify the image
    cy, cx = frame.shape[0]/2, frame.shape[1]/2
    frame=frame.astype(numpy.int32)
    frame[cy-100:cy+100, cx-100:cx+100, 2] *= 1.5
    frame[frame>255]=255
    frame=frame.astype(numpy.uint8)

    # display the frame in a window
    cv2.imshow("camera", frame)
    
    # show image info and frame rate
    count += 1
    if count % span == 0:
        t1 = time.time()
        fps = span / (t1 - t0)
        message = "{0:4} ({1:8.3f} fps)".format(count, fps)
        imgutil.imageInfo(frame, message)
        t0 = t1
        
    key = cv2.waitKey(10)
예제 #3
0
# The new version of OpenCV (2.3.1) uses the cv2 package
import cv2
import imgutil

# open a connection to a usb-connected camera, e.g webcam
cam = cv2.VideoCapture(0)

# open a video file
# cam = cv2.VideoCapture("countdown.avi")

# run a loop until the escape key is pressed
while cv2.waitKey(20) != 27:
    # grab a frame from the camera
    flag, frame = cam.read()
    
    # display the frame in a window
    cv2.imshow("camera", frame)

imgutil.imageInfo(frame, "info")