Merge pull request #1398 from pierotofy/fixes

Fix --camera-lens
pull/1401/head
Piero Toffanin 2022-01-07 17:56:08 -05:00 zatwierdzone przez GitHub
commit 08fcb03f22
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 19 dodań i 7 usunięć

Wyświetl plik

@ -167,8 +167,8 @@ include(ProcessorCount)
ProcessorCount(nproc)
if (WIN32)
set (POISSON_BUILD_CMD ${CMAKE_MAKE_PROGRAM} ${SB_SOURCE_DIR}/PoissonRecon/PoissonRecon.vcxproj /p:configuration=${CMAKE_BUILD_TYPE} /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
set (POISSON_BIN_PATH "Win32/${CMAKE_BUILD_TYPE}/PoissonRecon.exe")
set (POISSON_BUILD_CMD ${CMAKE_MAKE_PROGRAM} ${SB_SOURCE_DIR}/PoissonRecon/PoissonRecon.vcxproj /p:configuration=${CMAKE_BUILD_TYPE} /p:Platform=x64 /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
set (POISSON_BIN_PATH "x64/${CMAKE_BUILD_TYPE}/PoissonRecon.exe")
else()
set (POISSON_BUILD_CMD make -j${nproc} poissonrecon)
set (POISSON_BIN_PATH "Linux/PoissonRecon")

Wyświetl plik

@ -180,12 +180,12 @@ def config(argv=None, parser=None):
'Can be specified either as path to a cameras.json file or as a '
'JSON string representing the contents of a '
'cameras.json file. Default: %(default)s')
parser.add_argument('--camera-lens',
metavar='<string>',
action=StoreValue,
default='auto',
choices=['auto', 'perspective', 'brown', 'fisheye', 'spherical'],
choices=['auto', 'perspective', 'brown', 'fisheye', 'spherical', 'equirectangular', 'dual'],
help=('Set a camera projection type. Manually setting a value '
'can help improve geometric undistortion. By default the application '
'tries to determine a lens type from the images metadata. Can be one of: %(choices)s. Default: '

Wyświetl plik

@ -186,7 +186,7 @@ def create_dem(input_point_cloud, dem_type, output_type='max', radiuses=['0.56']
for t in tiles:
if not os.path.exists(t['filename']):
raise Exception("Error creating %s, %s failed to be created" % (output_file, t['filename']))
# Create virtual raster
tiles_vrt_path = os.path.abspath(os.path.join(outdir, "tiles.vrt"))
tiles_file_list = os.path.abspath(os.path.join(outdir, "tiles_list.txt"))
@ -315,6 +315,8 @@ def median_smoothing(geotiff_path, output_path, smoothing_iterations=1):
dtype = img.dtypes[0]
arr = img.read()[0]
nodata_locs = numpy.where(arr == nodata)
# Median filter (careful, changing the value 5 might require tweaking)
# the lines below. There's another numpy function that takes care of
# these edge cases, but it's slower.
@ -330,8 +332,7 @@ def median_smoothing(geotiff_path, output_path, smoothing_iterations=1):
arr[-1][-2:] = arr[-2][-1] = arr[-2][-2]
# Median filter leaves a bunch of zeros in nodata areas
locs = numpy.where(arr == 0.0)
arr[locs] = nodata
arr[nodata_locs] = nodata
# write output
with rasterio.open(output_path, 'w', **img.profile) as imgout:

Wyświetl plik

@ -617,6 +617,10 @@ class ODM_Photo:
def override_gps_dop(self, dop):
self.gps_xy_stddev = self.gps_z_stddev = dop
def override_camera_projection(self, camera_projection):
if camera_projection in projections:
self.camera_projection = camera_projection
def is_thermal(self):
#Added for support M2EA camera sensor
if(self.camera_make == "DJI"):

Wyświetl plik

@ -136,6 +136,13 @@ class ODMLoadDatasetStage(types.ODM_Stage):
for p in photos:
p.override_gps_dop(args.gps_accuracy)
# Override projection type
if args.camera_lens != "auto":
log.ODM_INFO("Setting camera lens to %s for all images" % args.camera_lens)
for p in photos:
p.override_camera_projection(args.camera_lens)
# Save image database for faster restart
save_images_database(photos, images_database_file)