本 SDK を使用したアプリケーションが動作するスマートフォンと THETAを無線 LAN 接続しておきます。
import {initialize} from 'theta-client-react-native';
initialize()
.then(() => {
// success
})
.catch(() => {
// handle error
});
OR
initialize('http://<IPアドレス>:<ポート番号>')
.then(() => {
// success
})
.catch(() => {
// handle error
});
THETA IP ADDRESS
| モード | アドレス |
|---|---|
| ダイレクトモード | 192.168.1.1 |
| その他 | カメラの IP アドレス |
Theta から画像や動画をダウンロードする場合は、plainな接続となりますので、接続先のアドレス(デフォルト192.168.1.1)に応じて各プラットフォーム毎の設定が必要になります。
iOS: デフォルトの場合の Info.plist の例を示します。なお、XcodeのSigning&Capabilities→App Transport Security Exceptionでも追加設定することができます。
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<http://www.apple.com/DTDs/PropertyList-1.0.dtd>">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>192.168.1.1</key>
<dict>
<key>NSIncludesSubdomain</key>
<false/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
</dict>
</plist>
Android: res/xml/network_security_config.xmlに記述するデフォルトの場合の例を示します。
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">192.168.1.1</domain>
</domain-config>
</network-security-config>
まずgetPhotoCaptureBuilder()を使って撮影設定を行い、PhotoCaptureオブジェクトを生成します。
import {
getPhotoCaptureBuilder,
IsoAutoHighLimitEnum,
PhotoFileFormatEnum,
} from 'theta-client-react-native';
getPhotoCaptureBuilder()
.setIsoAutoHighLimit(IsoAutoHighLimitEnum.ISO_1000)
.setFileFormat(PhotoFileFormatEnum.IMAGE_5K)
.build()
.then((photoCapture) => {
// success build photoCapture
})
.catch((error) => {
// handle error
});
上の例では ISO 感度の最大値を 1000 に、ファイルフォーマットをIMAGE_5K に設定しています。
プレビューを表示する方法はプレビューを表示するをご覧ください。
次にPhotoCapture.takePicture()を呼んで静止画を撮影します。
photoCapture.takePicture()
.then(fileUrl => {
// fileUrl をGETリクエストを送信してJPEGファイルを受け取る処理
})
.catch(error => {
// catch error while take picture
});
露出補正 - setExposureCompensation(value:ExposureCompensationEnum)
| 値 | 補正値 | 備考 |
|---|---|---|
| M_2_0 | -2.0f | |
| M_1_7 | -1.7f | |
| M_1_3 | -1.0f | |
| M_0_7 | -0.7f | |
| M_0_3 | -0.3f | |
| ZERO | 0.0f | デフォルト |
| P_0_3 | 0.3f | |
| P_0_7 | 0.7f | |
| P_1_3 | 1.0f | |
| P_1_7 | 1.7f | |
| P_2_0 | 2.0f |
露出遅延設定 - setExposureDelay(delay:ExposureDelayEnum) takePicture コマンドと露出開始間の遅延時間(=セルフタイマー)
| 値 | 遅延時間(秒) | 備考 |
|---|---|---|
| DELAY_OFF | 0 | デフォルト |
| DELAY_1 | 1 | |
| DELAY_2 | 2 | |
| DELAY_3 | 3 | |
| DELAY_4 | 4 | |
| DELAY_5 | 5 | |
| DELAY_6 | 6 | |
| DELAY_7 | 7 | |
| DELAY_8 | 8 | |
| DELAY_9 | 9 | |
| DELAY_10 | 10 |
露出プログラム - setExposureProgram(program:ExposureProgramEnum)
| 値 | 内容 | 備考 |
|---|---|---|
| MANUAL | 手動 | |
| NORMAL_PROGRAM | 通常のプログラム | |
| APERTURE_PRIORITY | 絞り優先 | |
| SHUTTER_PRIORITY | シャッター優先 | |
| ISO_PRIORITY | ISO 優先 |
ファイルフォーマット - setFileFormat(fileFormat:PhotoFileFormatEnum)
| 値 | タイプ | 幅 | 高さ | S | SC | V | Z1 | X |
|---|---|---|---|---|---|---|---|---|
| IMAGE_2K | jpeg | 2048 | 1024 | ○ | ○ | × | × | × |
| IMAGE_5K | jpeg | 5376 | 2688 | ○ | ○ | ○ | × | × |
| IMAGE_6_7K | jpeg | 6720 | 3360 | × | × | × | ○ | × |
| RAW_P_6_7K | raw+ | 6720 | 3360 | × | × | × | ○ | × |
| IMAGE_5_5K | jpeg | 5504 | 2752 | × | × | × | × | ○ |
| IMAGE_11K | jpeg | 11008 | 5504 | × | × | × | × | ○ |
画像処理 - setFilter(filter:FilterEnum)
| 値 | 内容 | 備考 |
|---|---|---|
| OFF | なし | |
| NOISE_REDUCTION | ノイズ軽減 | |
| HDR | HDR | デフォルト |
GPS オン/オフ - setGpsTagRecording(value:GpsTagRecordingEnum) THETA X 以外は指定しても無視される
| 値 | 内容 | 備考 |
|---|---|---|
| ON | GPS あり | デフォルト |
| OFF | GPS なし |