コード例 #1
0
        if feat[-2:] == "00" and feat[:-2] + "25" in im:
            tmp = loc
            im[feat] = im[feat[:-2] + "25"]
            im[feat[:-2] + "25"] = tmp

# choose features that appear in 2+
feature_counts = Counter(
    [f for i in image_feature_locations.values() for f in i.keys()])
common_features = [f for f in feature_counts if feature_counts[f] > 1]
pmt_locations = {
    k: p
    for k, p in all_pmt_locations.items() if k in common_features
}

# generate bolt locations from PMT locations
bolt_locations = sk.get_bolt_locations_barrel(pmt_locations)
common_feature_locations = {**pmt_locations, **bolt_locations}
common_image_pmt_locations = {
    k: {
        j: f
        for j, f in i.items() if j in common_features and j in pmt_locations
    }
    for k, i in image_feature_locations.items()
}
common_image_feature_locations = {
    k: {
        j: f
        for j, f in i.items()
        if j in common_features and j in common_feature_locations
    }
    for k, i in image_feature_locations.items()
コード例 #2
0
filename_no_extension = os.path.splitext(filename)[0]
camera_rotations = np.zeros((1, 3))
camera_translations = np.zeros((1, 3))
camera_rotations[0, :] = rotation_vector.ravel()
camera_translations[0, :] = translation_vector.ravel()

outputTextFilename = os.path.join(filename_no_extension + "-" + inputFileType +
                                  " - angle to vertical.txt")
print("Creating file for writing output:", outputTextFilename)
outputFile = open(outputTextFilename, "w")

# Read all 3D PMT locations
all_pmt_locations = fit.read_3d_feature_locations(
    "parameters/SK_all_PMT_locations.txt")

all_bolt_locations = sk.get_bolt_locations_barrel(all_pmt_locations)

# Obtain 2D reprojected feature points
pmt_reprojected_points = obtain_reprojected_points(all_pmt_locations)

feature_reprojected_points = obtain_reprojected_points(all_bolt_locations)

pmt_repro_coords = np.stack(
    list(pmt_reprojected_points[filename_no_extension].values()))

feature_repro_coords = np.stack(
    list(feature_reprojected_points[filename_no_extension].values()))

# Read all 2D locations from input file
input_feature_locations = read_image_feature_locations(textFilename,
                                                       offset=np.array(