Samsungの2眼全天球カメラGear360を買いました。カメラの紹介は下記が詳しいです。
Galaxy系の端末しかサポートいないみたいですが、下記ブログ記事を見るとGoogleが策定(?)したOpen Sperical Camera(OSC) APIに対応しているようだ。
[Gear360をUnityで動かしてみた]
(http://noshipu.hateblo.jp/entry/2016/07/28/034706)
ISO感度、露出時間、ホワイトバランス、露出補正、シャッター時間等々を変えられるか調べてみた。
方法は、下記に記載されている全パラメータを
Open Sperical Camera(OSC) API options
- camera.getOptionsで取得できるか
- camera.setOptions でsetして、camera.getOptionsでsetした値が取得できるか(supportされてないけど実はsetできたりしないか?)
- camera.setOptions でsetして、撮影して画像に変化があるか、exifに反映されているか(supportされてないけど実はsetできたりしないか?)
を試してみた。
結論としては、何も変えられない。
言い換えるとオート撮影しかできない。
自分の理解と実装が間違っている可能性もあるので、間違いあればご指摘お願いします。
以下、検証用のコードです。
gear360.py
# -*- coding: utf-8 -*-
"""
"""
import urllib
import json
def check_support_val(sessionId, opt, vals):
for val in vals:
# set option
data = json.dumps({"name":"camera.setOptions", \
"parameters": {"sessionId": sessionId, "options": {opt: str(val)}}})
res = urllib.urlopen("http://" + ip_address + '/osc/commands/execute', data)
#res_dict = json.loads(res.read())
take_picture(sessionId, "img_" + opt + "_" + str(val) + ".jpg")
# get option
data = json.dumps({"name":"camera.getOptions", \
"parameters": {"sessionId": sessionId, "optionNames": [opt]}})
res = urllib.urlopen("http://" + ip_address + '/osc/commands/execute', data)
res_dict = json.loads(res.read())
if res_dict["results"]["options"].has_key(opt):
print "{0}: set={1}, get={2}".format(\
opt, val, res_dict["results"]["options"][opt])
else:
print "{0}: not support.".format(opt)
def take_picture(sessionId, picture_fn):
data = json.dumps({"name":"camera.takePicture", \
"parameters": {"sessionId": sessionId}})
res = urllib.urlopen("http://" + ip_address + '/osc/commands/execute', data)
photo_id_dict = json.loads(res.read())
photo_id = photo_id_dict["id"]
fileUri = ""
state = ""
while not state == "done":
#res = urllib.urlopen("http://" + ip_address + '/osc/state', urllib.urlencode({}))
#res = urllib.urlopen("http://" + ip_address + '/osc/checkForUpdates', urllib.urlencode({}))
data = json.dumps({"id": photo_id})
res = urllib.urlopen("http://" + ip_address + '/osc/commands/status', data)
res_dict = json.loads(res.read())
state = res_dict["state"]
#print res_dict
#fileUri = json.loads(res.read())["state"]["_latestFileUri"]
fileUri = res_dict["results"]["fileUri"]
data = json.dumps({"name":"camera.getImage", "parameters": {"fileUri": fileUri}})
res = urllib.urlopen("http://" + ip_address + '/osc/commands/execute', data)
with open(picture_fn, "wb") as file:
file.write(res.read())
def start_session():
data = json.dumps({"name":"camera.startSession"})
res = urllib.urlopen("http://" + ip_address + '/osc/commands/execute', data)
sessionId = json.loads(res.read())["results"]["sessionId"]
return sessionId
def close_session(sessionId):
data = json.dumps({"name":"camera.closeSession", "parameters": {"sessionId": sessionId}})
urllib.urlopen("http://" + ip_address + '/osc/commands/execute', data)
# ip_address = "192.168.1.1" # theta s
ip_address = "192.168.107.1" # gear360
options = [ \
"captureMode", \
"captureModeSupport", \
"exposureProgram", \
"exposureProgramSupport", \
"iso", \
"isoSupport", \
"shutterSpeed", \
"shutterSpeedSupport", \
"aperture", \
"apertureSupport", \
"whiteBalance", \
"whiteBalanceSupport", \
"exposureCompensation", \
"exposureCompensationSupport", \
"fileFormat", \
"fileFormatSupport", \
"exposureDelay", \
"exposureDelaySupport", \
"sleepDelay", \
"sleepDelaySupport", \
"offDelay", \
"offDelaySupport", \
"totalSpace", \
"remainingSpace", \
"remainingPictures", \
"gpsInfo", \
"dateTimeZone", \
"hdr", \
"hdrSupport", \
"exposureBracket", \
"exposureBracketSupport", \
"gyro", \
"gyroSupport", \
"gps", \
"gpsSupport", \
"imageStabilization", \
"imageStabilizationSupport", \
"wifiPassword", \
"previewFormat", \
"previewFormatSupport", \
"captureInterval", \
"captureIntervalSupport", \
"captureNumber", \
"captureNumberSupport", \
"remainingVideoSeconds", \
"pollingDelay", \
"delayProcessing", \
"delayProcessingSupport", \
"clientVersion", \
"_vendorSpecific"
]
print urllib.urlopen("http://" + ip_address + "/osc/info").read()
sessionId = start_session()
print sessionId
print "--------"
for opt in options:
data = json.dumps({"name":"camera.getOptions", \
"parameters": {"sessionId": sessionId, "optionNames": [opt]}})
res = urllib.urlopen("http://" + ip_address + '/osc/commands/execute', data)
res_dict = json.loads(res.read())
try:
print "{0}: {1}".format(opt, res_dict["results"]["options"][opt])
except:
print "{0}: not support.".format(opt)
#print res_dict
check_support_val(sessionId, "iso", ["", 100, 200, 400, 800, 1600])
check_support_val(sessionId, "shutterSpeed", ["", 0.067, 0.033, 0.017,0.008])
check_support_val(sessionId, "aperture", ["", 1.4, 2, 2.8, 4, 5.6, 8, 11, 0])
check_support_val(sessionId, "whiteBalance", ["auto", "incandescent", "fluorescent", "daylight", "cloudy-daylight", "shade", "twilight"])
check_support_val(sessionId, "exposureCompensation", ["", -1, -0.67, -0.33, 0, 0.33, 0.67, 1])
# check_support_val(sessionId, "exposureCompensation", ["", -2.0, -1.7, -1.3, -1.0, -0.7, -0.3, 0.0, 0.3, 0.7, 1.0, 1.3, 1.7, 2.0]
# check_support_val("exposureDelay", ["", 0, 1, 2, 5, 10, 30, 60])
# check_support_val("sleepDelay", [30, 60, 120, 300, 600, 1800, 65535])
# check_support_val("offDelaySupport", [1800, 3600, 7200, 65535])
close_session(sessionId)