2022-06-02 19:44:11 +00:00
from opendm import log
# Make Model (lowercase) --> readout time (ms)
RS_DATABASE = {
2023-06-30 19:41:31 +00:00
' autel robotics xt701 ' : 25 , # Autel Evo II 8k
2022-06-02 19:44:11 +00:00
' dji phantom vision fc200 ' : 74 , # Phantom 2
' dji fc300s ' : 33 , # Phantom 3 Advanced
2022-06-13 18:42:32 +00:00
' dji fc300c ' : 33 , # Phantom 3 Standard
2022-06-02 19:44:11 +00:00
' dji fc300x ' : 33 , # Phantom 3 Professional
' dji fc330 ' : 33 , # Phantom 4
' dji fc6310 ' : 33 , # Phantom 4 Professional
2023-05-04 16:58:32 +00:00
' dji fc7203 ' : lambda p : 19 if p . get_capture_megapixels ( ) < 10 else 25 , # DJI Mavic Mini v1 (at 16:9 => 9MP 19ms, at 4:3 => 12MP 25ms)
2022-12-24 14:23:32 +00:00
' dji fc2103 ' : 32 , # DJI Mavic Air 1
2022-06-18 04:01:51 +00:00
' dji fc3170 ' : 27 , # DJI Mavic Air 2
2022-07-20 22:22:48 +00:00
' dji fc3411 ' : 32 , # DJI Mavic Air 2S
2022-08-11 20:59:00 +00:00
2022-12-15 10:26:01 +00:00
' dji fc220 ' : 64 , # DJI Mavic Pro (Platinum)
2022-09-28 17:18:43 +00:00
' hasselblad l1d-20c ' : lambda p : 47 if p . get_capture_megapixels ( ) < 17 else 56 , # DJI Mavic 2 Pro (at 16:10 => 16.8MP 47ms, at 3:2 => 19.9MP 56ms. 4:3 has 17.7MP with same image height as 3:2 which can be concluded as same sensor readout)
2024-02-12 14:50:22 +00:00
' hasselblad l2d-20c ' : 16.6 , # DJI Mavic 3 (not enterprise version)
2022-06-15 12:40:34 +00:00
2022-07-25 16:33:11 +00:00
' dji fc3582 ' : lambda p : 26 if p . get_capture_megapixels ( ) < 48 else 60 , # DJI Mini 3 pro (at 48MP readout is 60ms, at 12MP it's 26ms)
2022-06-02 19:44:11 +00:00
' dji fc350 ' : 30 , # Inspire 1
2022-08-03 11:18:42 +00:00
2023-05-04 15:48:38 +00:00
' dji mavic2-enterprise-advanced ' : 31 , # DJI Mavic 2 Enterprise Advanced
' dji zenmuse z30 ' : 8 , # DJI Zenmuse Z30
2022-08-03 11:18:42 +00:00
' yuneec e90 ' : 44 , # Yuneec E90
2022-06-02 19:44:11 +00:00
2022-06-16 16:47:33 +00:00
' gopro hero4 black ' : 30 , # GoPro Hero 4 Black
2022-06-24 02:59:47 +00:00
' gopro hero8 black ' : 17 , # GoPro Hero 8 Black
2022-06-02 19:44:11 +00:00
2022-12-05 16:58:10 +00:00
' teracube teracube one ' : 32 , # TeraCube TeraCube_One TR1907Q Mobile Phone
2022-06-24 02:40:22 +00:00
2022-12-06 06:21:06 +00:00
' fujifilm x-a5 ' : 186 , # FUJIFILM X-A5 Mirrorless Interchangeable Lens Camera
2022-12-05 16:58:10 +00:00
' fujifilm x-t2 ' : 35 , # FUJIFILM X-T2 Mirrorless Interchangeable Lens Camera
2022-12-05 05:16:58 +00:00
2023-03-17 11:03:00 +00:00
' autel robotics xl724 ' : 29 , # Autel Nano+
2022-07-25 16:33:11 +00:00
2023-07-06 22:39:10 +00:00
' parrot anafi ' : 39 , # Parrot Anafi
2023-07-12 08:55:59 +00:00
' autel robotics xt705 ' : 30 , # Autel EVO II pro
2022-06-17 19:18:09 +00:00
# Help us add more!
# See: https://github.com/OpenDroneMap/RSCalibration for instructions
2022-06-02 19:44:11 +00:00
}
DEFAULT_RS_READOUT = 30 # Just a guess
def make_model_key ( make , model ) :
return ( " %s %s " % ( make . strip ( ) , model . strip ( ) ) ) . lower ( ) . strip ( )
warn_db_missing = { }
2022-06-29 03:56:49 +00:00
info_db_found = { }
2022-06-02 19:44:11 +00:00
2022-07-25 16:33:11 +00:00
def get_rolling_shutter_readout ( photo , override_value = 0 ) :
2022-06-02 19:44:11 +00:00
global warn_db_missing
2022-06-29 05:12:38 +00:00
global info_db_found
2022-06-02 19:44:11 +00:00
2022-07-25 16:33:11 +00:00
make , model = photo . camera_make , photo . camera_model
2022-06-02 19:44:11 +00:00
if override_value > 0 :
return override_value
key = make_model_key ( make , model )
if key in RS_DATABASE :
2022-07-25 16:33:11 +00:00
rsd = RS_DATABASE [ key ]
2022-07-26 18:59:21 +00:00
val = DEFAULT_RS_READOUT
2022-07-25 16:33:11 +00:00
if isinstance ( rsd , int ) or isinstance ( rsd , float ) :
val = float ( rsd )
elif callable ( rsd ) :
val = float ( rsd ( photo ) )
else :
log . ODM_WARNING ( " Invalid rolling shutter calibration entry, returning default of %s ms " % DEFAULT_RS_READOUT )
2022-06-29 03:56:49 +00:00
if not key in info_db_found :
2022-07-25 16:33:11 +00:00
log . ODM_INFO ( " Rolling shutter profile for \" %s %s \" selected, using %s ms as --rolling-shutter-readout. " % ( make , model , val ) )
2022-06-29 03:56:49 +00:00
info_db_found [ key ] = True
2022-07-25 16:33:11 +00:00
return val
2022-06-02 19:44:11 +00:00
else :
# Warn once
if not key in warn_db_missing :
2022-06-17 19:18:09 +00:00
log . ODM_WARNING ( " Rolling shutter readout time for \" %s %s \" is not in our database, using default of %s ms which might be incorrect. Use --rolling-shutter-readout to set an actual value (see https://github.com/OpenDroneMap/RSCalibration for instructions on how to calculate this value) " % ( make , model , DEFAULT_RS_READOUT ) )
2022-06-02 19:44:11 +00:00
warn_db_missing [ key ] = True
2022-06-18 04:01:51 +00:00
return float ( DEFAULT_RS_READOUT )
2022-12-05 05:16:58 +00:00