Difference in Advance Mode Controls and Acquisition Parameters
I'm currently working on a script to optimize acquisition parameters for my experiment. It seems like there are two ways to manipulate which advanced parameters are being used. You can load in a json file that contains the parameters you want.
Here is a script I wrote to do that. First, I used the realsense-viewer's advanced mode to change some parameters and then I saved the json file. By doing this, I was able to get a list of what I thought were all the acquisition parameters (since it isn't listed anywhere). Using that info I wrote something where I can create a json with the parameter values that I want.
`values= [400, 0.461914, -0.553711, -0.553711, 0.0458984, 0.540039, 0.540039, 0.208008, -0.332031, -0.212891, -0.212891, 0.68457, 0.930664, 65536, 624, 53, "True", 33000, "True", 166, 0, 0 , 50, 64, 300, 0, 3, 64, 50, "True", 4600, 16, "False", 150, "on", 0, 400, 9, 9, 9, 9, 65536, 624, 901, 0, 0, 0, 0, 0, 0, 53, 800, 26, 24, 2047, 500, 1, 7, 1, 1, 3, 1, 1, 3, 0.0499022, 0.0499022, 0.0499022, 3, 1, 10, 10, 4, 1, 0.375, 72, 72, 72, 60, 105, 70, 342, 190, 130, 325, 0, 0, 1, 901]
def writeD415Json(path,filename,values): filepathname= './' + path + filename + '.json' parameters={} parameters["aux-param-autoexposure-setpoint"]=str(values[0]) parameters["aux-param-colorcorrection1"]=str(values[1]) parameters["aux-param-colorcorrection10"]=str(values[2]) parameters["aux-param-colorcorrection11"]=str(values[3]) parameters["aux-param-colorcorrection12"]=str(values[4]) parameters["aux-param-colorcorrection2"]=str(values[5]) parameters["aux-param-colorcorrection3"]=str(values[6]) parameters["aux-param-colorcorrection4"]=str(values[7]) parameters["aux-param-colorcorrection5"]=str(values[8]) parameters["aux-param-colorcorrection6"]=str(values[9]) parameters["aux-param-colorcorrection7"]=str(values[10]) parameters["aux-param-colorcorrection8"]=str(values[11]) parameters["aux-param-colorcorrection9"]=str(values[12]) parameters["aux-param-depthclampmax"]=str(values[13]) parameters["aux-param-depthclampmin"]=str(values[14]) parameters["aux-param-disparityshift"]=str(values[15]) parameters["controls-autoexposure-auto"]=str(values[16]) parameters["controls-autoexposure-manual"]=str(values[17]) parameters["controls-color-autoexposure-auto"]=str(values[18]) parameters["controls-color-autoexposure-manual"]=str(values[19]) parameters["controls-color-backlight-compensation"]=str(values[20]) parameters["controls-color-brightness"]=str(values[21]) parameters["controls-color-contrast"]=str(values[22]) parameters["controls-color-gain"]=str(values[23]) parameters["controls-color-gamma"]=str(values[24]) parameters["controls-color-hue"]=str(values[25]) parameters["controls-color-power-line-frequency"]=str(values[26]) parameters["controls-color-saturation"]=str(values[27]) parameters["controls-color-sharpness"]=str(values[28]) parameters["controls-color-white-balance-auto"]=str(values[29]) parameters["controls-color-white-balance-manual"]=str(values[30]) parameters["controls-depth-gain"]=str(values[31]) parameters["controls-depth-white-balance-auto"]=str(values[32]) parameters["controls-laserpower"]=str(values[33]) parameters["controls-laserstate"]=str(values[34]) parameters["ignoreSAD"]=str(values[35]) parameters["param-autoexposure-setpoint"]=str(values[36]) parameters["param-censusenablereg-udiameter"]=str(values[37]) parameters["param-censusenablereg-vdiameter"]=str(values[38]) parameters["param-censususize"]=str(values[39]) parameters["param-censusvsize"]=str(values[40]) parameters["param-depthclampmax"]=str(values[41]) parameters["param-depthclampmin"]=str(values[42]) parameters["param-depthunits"]=str(values[43]) parameters["param-disableraucolor"]=str(values[44]) parameters["param-disablesadcolor"]=str(values[45]) parameters["param-disablesadnormalize"]=str(values[46]) parameters["param-disablesloleftcolor"]=str(values[47]) parameters["param-disableslorightcolor"]=str(values[48]) parameters["param-disparitymode"]=str(values[49]) parameters["param-disparityshift"]=str(values[50]) parameters["param-lambdaad"]=str(values[51]) parameters["param-lambdacensus"]=str(values[52]) parameters["param-leftrightthreshold"]=str(values[53]) parameters["param-maxscorethreshb"]=str(values[54]) parameters["param-medianthreshold"]=str(values[55]) parameters["param-minscorethresha"]=str(values[56]) parameters["param-neighborthresh"]=str(values[57]) parameters["param-raumine"]=str(values[58]) parameters["param-rauminn"]=str(values[59]) parameters["param-rauminnssum"]=str(values[60]) parameters["param-raumins"]=str(values[61]) parameters["param-rauminw"]=str(values[62]) parameters["param-rauminwesum"]=str(values[63]) parameters["param-regioncolorthresholdb"]=str(values[64]) parameters["param-regioncolorthresholdg"]=str(values[65]) parameters["param-regioncolorthresholdr"]=str(values[66]) parameters["param-regionshrinku"]=str(values[67]) parameters["param-regionshrinkv"]=str(values[68]) parameters["param-robbinsmonrodecrement"]=str(values[69]) parameters["param-robbinsmonroincrement"]=str(values[70]) parameters["param-rsmdiffthreshold"]=str(values[71]) parameters["param-rsmrauslodiffthreshold"]=str(values[72]) parameters["param-rsmremovethreshold"]=str(values[73]) parameters["param-scanlineedgetaub"]=str(values[74]) parameters["param-scanlineedgetaug"]=str(values[75]) parameters["param-scanlineedgetaur"]=str(values[76]) parameters["param-scanlinep1"]=str(values[77]) parameters["param-scanlinep1onediscon"]=str(values[78]) parameters["param-scanlinep1twodiscon"]=str(values[79]) parameters["param-scanlinep2"]=str(values[80]) parameters["param-scanlinep2onediscon"]=str(values[81]) parameters["param-scanlinep2twodiscon"]=str(values[82]) parameters["param-secondpeakdelta"]=str(values[83]) parameters["param-texturecountthresh"]=str(values[84]) parameters["param-texturedifferencethresh"]=str(values[85]) parameters["param-usersm"]=str(values[86]) parameters["param-zunits"]=str(values[87])
with open(filepathname, 'w') as fp:
json.dump(parameters, fp)
filename='practice_writing_file' path='./' writeD415Json(path,filename,values)`
The problem is that I don't think I am getting all the acquisition parameters. I looked at some of the API and found this page https://github.com/IntelRealSense/librealsense/blob/ba01147d65db16fdf4da36a3e718fe81c8421034/src/ds5/advanced_mode/presets.cpp I see parameters listed here, such as deepSeaMedianThreshold, that I did not see in MY list of parameters. Another strategy I could use is using the functions advnc_mode.set_... that I .found in the python wrapper examples page
` # Get each control's current value print("Depth Control: \n", advnc_mode.get_depth_control()) print("RSM: \n", advnc_mode.get_rsm()) print("RAU Support Vector Control: \n", advnc_mode.get_rau_support_vector_control()) print("Color Control: \n", advnc_mode.get_color_control()) print("RAU Thresholds Control: \n", advnc_mode.get_rau_thresholds_control()) print("SLO Color Thresholds Control: \n", advnc_mode.get_slo_color_thresholds_control()) print("SLO Penalty Control: \n", advnc_mode.get_slo_penalty_control()) print("HDAD: \n", advnc_mode.get_hdad()) print("Color Correction: \n", advnc_mode.get_color_correction()) print("Depth Table: \n", advnc_mode.get_depth_table()) print("Auto Exposure Control: \n", advnc_mode.get_ae_control()) print("Census: \n", advnc_mode.get_census())
#To get the minimum and maximum value of each control use the mode value:
query_min_values_mode = 1
query_max_values_mode = 2
current_std_depth_control_group = advnc_mode.get_depth_control()
min_std_depth_control_group = advnc_mode.get_depth_control(query_min_values_mode)
max_std_depth_control_group = advnc_mode.get_depth_control(query_max_values_mode)
print("Depth Control Min Values: \n ", min_std_depth_control_group)
print("Depth Control Max Values: \n ", max_std_depth_control_group)
# Set some control with a new (median) value
current_std_depth_control_group.scoreThreshA = int((max_std_depth_control_group.scoreThreshA - min_std_depth_control_group.scoreThreshA) / 2)
advnc_mode.set_depth_control(current_std_depth_control_group)
print("After Setting new value, Depth Control: \n", advnc_mode.get_depth_control())`
For the second option, we are setting the control group. What I mean by that is that advnc_mode.set_depth_control sets the values of the GROUP of parameters all relating to depth control. I'd much rather be able to either control every parameter individually OR control ALL of the parameters (with some function like advnc_mode.set_ALL)
Any advice on how to do this?
Hi @GitwellAnyohub
Setting preset via JSON is reduced to setting control blocks via the advanced_mode API. This is the API we have to the camera firmware.
I believe your list is full and deepSeaMedianThreshold is param-medianthreshold - you can see the exact mapping here.
[Realsense Customer Engineering Team Comment] @GitwellAnyohub I think dorodnic's response should answer your question, can I close the issue?
[Realsense Customer Engineering Team Comment] @GitwellAnyohub Didn't get your response, assuming the issue is solved. Close the issue first, if you have any further question please reopen or file new issue.