2017-04-12 2 views

답변

0

Digicamcontrol이 링크를 확인 거의 모든 측면, 유틸리티는 명령 프롬프트에서 실행할 수있는 응용 프로그램을 제어하거나 유틸리티 명령 행 인수에 대한 자세한 정보를 들어 파이썬

에 subprocess.call를 사용하여 실행할 수있는 원격 유틸리티가 http://digicamcontrol.com/doc/userguide/remoteutil

0

여기 파이썬 3.5 (아나콘다를 통해 설치됨)를 사용하는 실제 해결책이 있습니다.

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) 
관련 문제