Example #1
0
    dd = np.array([0, p1, p2])
    # principal point
    principal_point = np.array([xp, yp])

    fiducialsCam = 'no fiducials'

    # create camera instance
    cam1 = cam(focal, principal_point, rd1, dd, fiducialsCam)

    # create SingleImage instances
    IMG_2003 = SingleImage(cam1)
    IMG_2004 = SingleImage(cam1)
    IMG_2005 = SingleImage(cam1)

    # points in images
    IMG_2003_points = rd.ReadSampleFile('IMG_2003.json')
    IMG_2004_points = rd.ReadSampleFile('IMG_2004.json')
    IMG_2005_points = rd.ReadSampleFile('IMG_2005.json')

    # Compute Inner Orientation
    inner_param_2003 = IMG_2003.ComputeInnerOrientation([])
    inner_param_2004 = IMG_2004.ComputeInnerOrientation([])
    inner_param_2005 = IMG_2005.ComputeInnerOrientation([])

    # image to camera
    cam_2003_points = IMG_2003.ImageToCamera(IMG_2003_points)
    cam_2004_points = IMG_2004.ImageToCamera(IMG_2004_points)
    cam_2005_points = IMG_2004.ImageToCamera(IMG_2005_points)

    # create ImagePair instances
    img_pair1 = ImagePair(IMG_2003, IMG_2004)
Example #2
0
    # bin_gauss = build_gaussian_pyramid(mask)
    # comb_laplac = combine_pyramids(George_laplac,ref_laplac,bin_gauss)
    # refrence_image[520*2:680*2,490*2:570*2] = build_from_pyramid(comb_laplac)
    # # refrence_image[520*2:680*2,490*2:570*2] = masked
    # plt.imshow(cv2.cvtColor(refrence_image, cv2.COLOR_BGR2RGB))
    # plt.xticks([]), plt.yticks([])
    # plt.show()

    # importing sampled points data
    sampled_points_files = []
    sampled_points_files = glob.glob(
        r'panorama\*.json'
    )  # reading the names of the json files in the folder
    images_points = []
    for filename in sampled_points_files:
        im_points = rd.ReadSampleFile(filename)
        images_points.append(im_points * (scale_percent / 100))
    refrence_image_points = images_points[
        3]  # points of the image that is the refrence plain

    # calculating transformation matrices
    trans_matrices = []
    for im in images_points[:4]:
        trans_matrices.append(
            transformation_parameters(refrence_image_points[:len(im)], im))
    trans_matrices.append(
        transformation_parameters(
            refrence_image_points[np.hstack(
                [np.arange(2, 6), np.arange(7, 20)])], images_points[4]))
    trans_matrices.append(
        transformation_parameters(refrence_image_points[np.arange(8, 20)],
Example #3
0
from ImagePair import ImagePair
import pandas as pd
import copy
from ImageTriple import ImageTriple

# Setting Parameters
y_size = 3648 # size of y axis of a picture
pix_s = 2.4e-3  #single pixel size (micron should be e-6)
focal = 4239.655*pix_s
ppoint = np.array([2746.295,1837.450])*pix_s
radial_d = np.array([0.0473,-0.414,])*pix_s
dece_d = np.array([-0.0014,-0.0028,0])*pix_s

# Reading and Creating list of Homological points
list_of_raw_points = []
list_of_raw_points.append(rd.ReadSampleFile(r'colorbase/IMG_1793.json'))
list_of_raw_points.append(rd.ReadSampleFile(r'colorbase/IMG_1794.json'))
list_of_raw_points.append(rd.ReadSampleFile(r'colorbase/IMG_1795.json'))

# Fixing camera axis
list_of_y_fixed_points = copy.deepcopy(list_of_raw_points)
for m in range(len(list_of_raw_points)):
    for row in range(len(list_of_raw_points[m]-1)):
        list_of_y_fixed_points[m][row,1] = y_size -  list_of_raw_points[m][row,1]

# Fixing camera center
list_of_y_center_fixed_points = copy.deepcopy(list_of_y_fixed_points)
for m in range(len(list_of_y_fixed_points)):
    for row in range(len(list_of_y_fixed_points[m]-1)):
        list_of_y_center_fixed_points[m][row,:] =\
        list_of_y_fixed_points[m][row,:] - ppoint/pix_s