Ask Your Question

Revision history [back]

Cv2.findTransformECC is causing blue screen

Hi, each time I try to run this code I'm getting a blue screen. Is openCv bugged?

this is a laptop with windows 8.1, no hardware modification, python 2.7x64 installed and openCv 3.1 x64 cv2.py is used

report incriminate ntoskrnl.exe

code :

def align_images_better(images):
    """
    Aligne all the images according to the first image in the folder
        -images : (list(image object)) unaligned images
        -return : (list(image object)) aligned images
    """

    aligned_images = []
    aligned_images.append(images[0])

    im1_gray = cv2.cvtColor(images[0], cv2.COLOR_BGR2GRAY)
    # Find size of image1
    sz = images[0].shape
    warp_matrix = np.eye(3, 3, dtype=np.float32)
    number_of_iterations = 5000;
    termination_eps = 1e-10;
    criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, number_of_iterations,  termination_eps)
    warp_mode = cv2.MOTION_HOMOGRAPHY

    for image in images[1:]:
        print "aligning picture"
        im2_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        print "findTransformECC"
        (cc, warp_matrix) = cv2.findTransformECC (im1_gray,im2_gray,warp_matrix, warp_mode, criteria)
        print "warping perspective"
        im2_aligned = cv2.warpPerspective (image, warp_matrix, (sz[1],sz[0]), flags=cv2.INTER_LINEAR + cv2.WARP_INVERSE_MAP)
        aligned_images(im2_aligned)

    return aligned_images

Thanks.