有沒有人在windows上這樣做是成功的?我試圖命令單反相機在Windows機器上用USB通過Python拍照。或者你有更好的解決方案(我無法切換到Linux)。使用digicamcontrol控制使用Python的尼康相機?
1
A
回答
0
Digicamcontrol具有遠程工具,它可以控制幾乎所有方面,該實用程序可在命令提示要運行的應用程序或使用subprocess.call在Python
有關實用程序命令行參數的詳細信息執行檢查此鏈接http://digicamcontrol.com/doc/userguide/remoteutil
0
下面是一個工作解決方案,使用Python 3.5(通過Anaconda安裝),BTW。
ISO和快門的參數是硬連線的,但是如果您需要的話,這應該會讓您繼續。
import sys
import os
import subprocess
import datetime
def func_TakeNikonPicture(input_filename):
camera_command = 'C:\Program Files (x86)\digiCamControl\CameraControlCmd.exe'
camera_command_details = '/filename ./' + input_filename + ' /capture /iso 500 /shutter 1/30 /aperture 1.8'
print('camera details = ',camera_command_details)
full_command=camera_command + ' ' + camera_command_details
p = subprocess.Popen(full_command, stdout=subprocess.PIPE, universal_newlines=True, shell=False)
(output, err) = p.communicate()
#This makes the wait possible
p_status = p.wait(1)
# print(p.stdout.readline())
#This will give you the output of the command being executed
print('Command output: ' + str(output))
print('Command err: ' + str(err))
print('done')
if(len(sys.argv) < 2):
rawimagename = 'test.jpg'
else:
# sys.argv[0] is the program name, sys.argv[1] is the first file, etc.
# need to shift this over
files = sys.argv[1:len(sys.argv)]
# Read the image
rawimagename = files[0]
if(os.path.isfile(rawimagename) is True):
print("File exists...not overwriting.")
sys.exit()
# Store date/time for file uniqueness
current_dt=datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
print("Current date time = " + current_dt)
rawimagename=current_dt + '_' + rawimagename
print('Name of raw image will be: ', rawimagename)
# take picture
func_TakeNikonPicture(rawimagename)
相關問題
- 1. 使用MTP控制尼康相機
- 2. 索尼行動相機的USB控制
- 3. 使用TouchAFPosition與索尼a6500相機
- 4. 使用索尼相機遠程API 2.4無法獲得索尼相機A6300
- 5. 使用Python控制計算機硬件
- 6. 使用Python控制Hyper-V虛擬機
- 7. 使用python控制藍牙手機
- 8. 使用Python腳本控制虛擬機
- 9. 使用康康舞
- 10. 不可用攝像機控制API函數,索尼開發SDK,相機WX500
- 11. 控制應用索尼Smartwatch2
- 12. python使用maemo相機
- 13. 索尼Qx 10 - 通過USB連接的相機觸發控制
- 14. 如何實現SSDP/UPnP?試圖使用索尼的相機API
- 15. 使用尼康D3400進行立體校準
- 16. 使用帶應用程序的iPhone控制外部相機
- 17. 索尼相機a6500:如何使用遠程SDK傳輸影片
- 18. 使用索尼相機遠程API同步多個QX1
- 19. 如何手動對焦使用索尼相機SDK通過WiFi
- 20. 使用Python控制vlc
- 21. 使用Python控制屏幕
- 22. 在基本控制器,而不是單獨的控制器使用爾康類
- 23. 使用Python烏龜繪製多米尼加國旗(不是多米尼加)
- 24. iOS相機使用政策不可見的相機監控
- 25. 使用Android視覺api時的相機自動對焦控制
- 26. 使用箭頭鍵的OpenGL相機控制
- 27. 使用directshow來控制相機和使用開放的cv來捕捉圖像
- 28. 使用相機
- 29. 如何使用相同的AJAX機制
- 30. 索尼相機關閉API