我正在尝试为我的Nikon D7200设置自动对焦区域
我检索了config对象,并在其中看到了这个条目:
{
"idx": "6,6,0,0",
"ro": 0,
"name": "changeafarea",
"label": "Set Nikon Autofocus area",
"type": 2,
"typestr": "GP_WIDGET_TEXT",
"value": "0x0"
},我不太确定要将哪些参数传递到gp_camera_set_single_config()
根据代码库,我需要通过gp_camera_set_single_config, ($self, name, widget, context)
为了将自动对焦的中心更改为像素100x100 (宽度x高度),我尝试了以下命令,但实际上没有得到任何结果。不知道有没有人碰巧知道怎么通过这个对讲机?
import gphoto2 as gp
# setup
camera = gp.check_result(gp.gp_camera_new())
context = None
gp.check_result(gp.gp_camera_init(camera, self.context))
# Method 1
gp.gp_camera_set_single_config(camera, 'changefarea', '100x100')
# Method 2
gp.gp_camera_set_single_config(camera, '--changefarea', '100x100')
# Method 3
gp.gp_camera_set_single_config(camera, 'changefarea', {
"idx": "6,6,0,0",
"ro": 0,
"name": "changeafarea",
"label": "Set Nikon Autofocus area",
"type": 2,
"typestr": "GP_WIDGET_TEXT",
"value": "100x100"
})
# Method 4
gp.gp_camera_set_single_config(camera, '--changefarea', {
"idx": "6,6,0,0",
"ro": 0,
"name": "changeafarea",
"label": "Set Nikon Autofocus area",
"type": 2,
"typestr": "GP_WIDGET_TEXT",
"value": "100x100"
})更新#1:
为了设置配置,您必须首先使用gp.gp_camera_get_single_config(camera, 'changefarea')获得配置。仍然不知道该通过什么对立面。
发布于 2022-01-31 18:23:52
下面是为我工作的东西,还不确定要传递哪些值,当我发现时会更新:
import gphoto2 as gp
camera = gp.check_result(gp.gp_camera_new())
context = None
gp.check_result(gp.gp_camera_init(camera, self.context))
config_name = "changeafarea"
value = "100x100" # in my code I have it linked up to PyQt5 window where I am clicking around the live-view and the pixel value of where I clicked is being passed back and formatted into this string format
while True:
# wait for config widget
config_widget = gp.gp_camera_get_single_config(self.camera, config_name)
if config_widget[1] is not None:
break
config_widget = config_widget[1]
config_set_response = gp.gp_widget_set_value(config_widget, value)
print('set response:', gp.gp_widget_get_value(config_widget))
gp.gp_camera_set_single_config(camera, config_name, config_widget)https://stackoverflow.com/questions/70910346
复制相似问题