def runPanoramaCylinderFull(folder_name):

	file_names = imageio.getImageNames(folder_name)
	
	panorama,mask = projectOnCylinder(imageio.readImageFloat(file_names[0]))
	for file_name in file_names[1:]:
		new_image,new_mask = projectOnCylinder(imageio.readImageFloat(file_name))

		panorama = mergeImages(new_image,panorama,transforms.computeTranslation,new_mask)
		
		print "Displaying the result so far:"
		figure, axis = plt.subplots(ncols=1)
		axis.imshow(panorama, vmin=0, vmax=1)
		plt.show()

	panorama_width = panorama.shape[1]

	image360 = mergeImages(panorama,panorama,transforms.computeTranslation,new_mask)

	image360_width = image360.shape[1]

	image360 = image360[:,0.25*image360_width:0.25*image360_width+(panorama_width-(2*panorama_width-image360_width))]

	print "Displaying the final result."
	figure, axis = plt.subplots(ncols=1)
	axis.imshow(image360, vmin=0, vmax=1)
	plt.show()
示例#2
0
def runAutoPanoramaCylinder(folder_name):
    transform_function = transforms.computeTranslation
    num_points_required_transform = 2

    file_names = imageio.getImageNames(folder_name)

    panorama, mask = manual.projectOnCylinder(
        imageio.readImageFloat(file_names[0]))

    for file_name in file_names[1:]:
        new_image, new_mask = manual.projectOnCylinder(
            imageio.readImageFloat(file_name))

        panorama = autoMerge(new_image, panorama, HARRIS_TRESHOLD_RELATIVE,
                             DESCRIPTOR_SHAPE_XY, NUM_POINTS_TO_FIND,
                             MIN_RADIUS_POINTS, RUSSIAN_GRANDMA_TRESHOLD,
                             NUM_STEPS_RANSAC, INLINERS_TRESHOLD_RANSAC,
                             transform_function, num_points_required_transform,
                             new_mask)

        print "Displaying the result so far:"
        figure, axis = plt.subplots(ncols=1)
        axis.imshow(panorama, vmin=0, vmax=1)
        plt.show()

    print "Displaying the final result."
    figure, axis = plt.subplots(ncols=1)
    axis.imshow(panorama, vmin=0, vmax=1)
    plt.show()
def runPanoramaCylinderFull(folder_name):

    file_names = imageio.getImageNames(folder_name)

    panorama, mask = projectOnCylinder(imageio.readImageFloat(file_names[0]))
    for file_name in file_names[1:]:
        new_image, new_mask = projectOnCylinder(
            imageio.readImageFloat(file_name))

        panorama = mergeImages(new_image, panorama,
                               transforms.computeTranslation, new_mask)

        print "Displaying the result so far:"
        figure, axis = plt.subplots(ncols=1)
        axis.imshow(panorama, vmin=0, vmax=1)
        plt.show()

    panorama_width = panorama.shape[1]

    image360 = mergeImages(panorama, panorama, transforms.computeTranslation,
                           new_mask)

    image360_width = image360.shape[1]

    image360 = image360[:, 0.25 * image360_width:0.25 * image360_width +
                        (panorama_width -
                         (2 * panorama_width - image360_width))]

    print "Displaying the final result."
    figure, axis = plt.subplots(ncols=1)
    axis.imshow(image360, vmin=0, vmax=1)
    plt.show()
def runRectification(image_name):
    img = imageio.readImageFloat(image_name)

    points = pointselecter.getFourPoints(img)

    print "Processing..... Please, wait."

    D_W = RESULTING_RECTIFICATION_WIDTH
    D_H = RESULTING_RECTIFICATION_HEIGHT
    border = RECTIFICATION_BORDER_FRACTION
    points_view = np.array([(border * D_W, border * D_H),
                            ((1 - border) * D_W, border * D_H),
                            ((1 - border) * D_W, (1 - border) * D_H),
                            (border * D_W, (1 - border) * D_H)])

    H = transforms.computeHomography(points, points_view)

    pts_x, pts_y = zip(*points)

    result_image = 0 * np.ones((D_H, D_W, 3))
    fill(img, result_image, H)

    print "Displaying the final result."
    figure, axis = plt.subplots(ncols=1)
    axis.imshow(result_image, vmin=0, vmax=1)
    plt.show()
def runPanoramaPlane(folder_name):

	file_names = imageio.getImageNames(folder_name)
	
	panorama = imageio.readImageFloat(file_names[0])
	for file_name in file_names[1:]:
		new_image = imageio.readImageFloat(file_name)
		panorama = mergeImages(new_image,panorama,transforms.computeHomography)

		print "Displaying the result so far:"
		figure, axis = plt.subplots(ncols=1)
		axis.imshow(panorama, vmin=0, vmax=1)
		plt.show()

	print "Displaying the final result."
	figure, axis = plt.subplots(ncols=1)
	axis.imshow(panorama, vmin=0, vmax=1)
	plt.show()
示例#6
0
def runAutoPanoramaCylinderFull(folder_name):
    transform_function = transforms.computeTranslation
    num_points_required_transform = 2

    file_names = imageio.getImageNames(folder_name)

    panorama, mask = manual.projectOnCylinder(
        imageio.readImageFloat(file_names[0]))
    for file_name in file_names[1:]:
        new_image, new_mask = manual.projectOnCylinder(
            imageio.readImageFloat(file_name))

        panorama = autoMerge(new_image, panorama, HARRIS_TRESHOLD_RELATIVE,
                             DESCRIPTOR_SHAPE_XY, NUM_POINTS_TO_FIND,
                             MIN_RADIUS_POINTS, RUSSIAN_GRANDMA_TRESHOLD,
                             NUM_STEPS_RANSAC, INLINERS_TRESHOLD_RANSAC,
                             transform_function, num_points_required_transform,
                             new_mask)

        print "Displaying the result so far:"
        figure, axis = plt.subplots(ncols=1)
        axis.imshow(panorama, vmin=0, vmax=1)
        plt.show()

    panorama_width = panorama.shape[1]

    points_1, points_2 = pointselecter.getPoints(source, reference)
    image360 = autoMerge(panorama, panorama, HARRIS_TRESHOLD_RELATIVE,
                         DESCRIPTOR_SHAPE_XY, NUM_POINTS_TO_FIND,
                         MIN_RADIUS_POINTS, RUSSIAN_GRANDMA_TRESHOLD,
                         NUM_STEPS_RANSAC, INLINERS_TRESHOLD_RANSAC,
                         transform_function, num_points_required_transform,
                         new_mask)

    image360_width = image360.shape[1]

    image360 = image360[:, 0.25 * image360_width:0.25 * image360_width +
                        (panorama_width -
                         (2 * panorama_width - image360_width))]

    print "Displaying the final result."
    figure, axis = plt.subplots(ncols=1)
    axis.imshow(image360, vmin=0, vmax=1)
    plt.show()
def runPanoramaPlane(folder_name):

    file_names = imageio.getImageNames(folder_name)

    panorama = imageio.readImageFloat(file_names[0])
    for file_name in file_names[1:]:
        new_image = imageio.readImageFloat(file_name)
        panorama = mergeImages(new_image, panorama,
                               transforms.computeHomography)

        print "Displaying the result so far:"
        figure, axis = plt.subplots(ncols=1)
        axis.imshow(panorama, vmin=0, vmax=1)
        plt.show()

    print "Displaying the final result."
    figure, axis = plt.subplots(ncols=1)
    axis.imshow(panorama, vmin=0, vmax=1)
    plt.show()
def runPanoramaCylinder(folder_name):

	file_names = imageio.getImageNames(folder_name)
	
	panorama,mask = projectOnCylinder(imageio.readImageFloat(file_names[0]))

	for file_name in file_names[1:]:
		new_image,new_mask = projectOnCylinder(imageio.readImageFloat(file_name))

		panorama = mergeImages(new_image,panorama,transforms.computeTranslation,new_mask)

		print "Displaying the result so far:"
		figure, axis = plt.subplots(ncols=1)
		axis.imshow(panorama, vmin=0, vmax=1)
		plt.show()

	print "Displaying the final result."
	figure, axis = plt.subplots(ncols=1)
	axis.imshow(panorama, vmin=0, vmax=1)
	plt.show()
def runPanoramaCylinder(folder_name):

    file_names = imageio.getImageNames(folder_name)

    panorama, mask = projectOnCylinder(imageio.readImageFloat(file_names[0]))

    for file_name in file_names[1:]:
        new_image, new_mask = projectOnCylinder(
            imageio.readImageFloat(file_name))

        panorama = mergeImages(new_image, panorama,
                               transforms.computeTranslation, new_mask)

        print "Displaying the result so far:"
        figure, axis = plt.subplots(ncols=1)
        axis.imshow(panorama, vmin=0, vmax=1)
        plt.show()

    print "Displaying the final result."
    figure, axis = plt.subplots(ncols=1)
    axis.imshow(panorama, vmin=0, vmax=1)
    plt.show()
def runRectification(image_name):
	img = imageio.readImageFloat(image_name)

	points = pointselecter.getFourPoints(img)

	print "Processing..... Please, wait."

	D_W = RESULTING_RECTIFICATION_WIDTH
	D_H = RESULTING_RECTIFICATION_HEIGHT
	border = RECTIFICATION_BORDER_FRACTION
	points_view = np.array([(border*D_W,border*D_H),((1-border)*D_W,border*D_H),((1-border)*D_W,(1-border)*D_H),(border*D_W,(1-border)*D_H)])

	H = transforms.computeHomography(points,points_view)

	pts_x, pts_y = zip(*points)

	result_image = 0*np.ones((D_H,D_W,3))
	fill(img,result_image,H)

	print "Displaying the final result."
	figure, axis = plt.subplots(ncols=1)
	axis.imshow(result_image, vmin=0, vmax=1)
	plt.show()