2016-04-07 6 views
3

カメラの自動露出を無効にしようとしています。ここの文書のhttps://developers.google.com/project-tango/apis/c/reference/group/config-paramsによれば、configにcolor_mode_auto、color_exp、およびcolor_isoの値を設定することができます。タンゴカメラの露出とisoパラメータをC#/ Unityから設定する方法

TangoApplication.csで作成した直後にTangoConfigオブジェクトに値を設定しようとしましたが、これらのTangoConfigが関連するキー(上記のドキュメントから直接取得したキー文字列名)。

C#でこれらの値を設定することはできますか?そうであれば、正しい場所はどこですか?

+1

設定変更をする前に行う必要があり

Camera.Parameters params = ret.camera.getParameters(); String flat = params.flatten(); String iso_keyword=null; if(flat.contains("iso-values")) { iso_keyword="iso"; } else if(flat.contains("iso-mode-values")) { iso_keyword="iso"; } else if(flat.contains("iso-speed-values")) { iso_keyword="iso-speed"; } else if(flat.contains("nv-picture-iso-values")) { iso_keyword="nv-picture-iso"; } if(iso_keyword == null) { Log.d("Unity", "CameraCaptureKit: It looks like there was no support for iso on the device."); return; } String strSupportedIsoValues = UnityCamera_GetSupportedISOValues(); ArrayList<String> supportedIsoValues = new ArrayList<String>(Arrays.asList(strSupportedIsoValues.split(","))); //ArrayList<String> supportedIsoValues = Arrays.asList(strSupportedIsoValues.split(",")); boolean contains = false; for(String isoValue : supportedIsoValues) { if(isoValue.contains(newValue)) { contains = true; break; } } if(contains == false) { Log.d("Unity", "CameraCaptureKit: failed to set ISO, the value " + newValue + " is not supported. (" + strSupportedIsoValues + ")"); return; } // update the camera. params.set(iso_keyword, newValue); ret.camera.setParameters(params); 

乾杯して、Androidのプラグイン内のパラメータを変更する必要がありますサービスが接続されています。それはあなたがやっていることですか? –

+0

私はそう信じている、ジェイソン。私は_TangoConnect()コール(行506、TangoApplication.cs)の直前にパラメータを設定した別のテストを試したところ、これは私が得た結果です:TangoConfig.SetBool()キーを設定できませんでした:config_color_mode_auto with value :False –

答えて

1

Unityカメラインスタンスでiso値と露出を設定できるプラグインを作成する必要があります。あなたはカメラのインスタンスを解決することを含むいくつかのトリッキーなハッカーでインスタンスを実行中のカメラの参照に持っていくことでそれを行うことができます。そして、iso/exposureパラメータを注入できるはずです。

、このようなプラグインの例はUnityのためカメラのキャプチャキット(https://www.assetstore.unity3d.com/en/#!/content/56673

それはカメラにフックすることができますし、プロパティを適用するようなものになるだろう。ここでは、カメラがどのように解決されたかについての抜粋です。

Class clsPlayer = Class.forName("com.unity3d.player.UnityPlayer"); 
    Field fCurrentActivity = clsPlayer.getDeclaredField("currentActivity"); 
    fCurrentActivity.setAccessible(true); 
    com.unity3d.player.UnityPlayerActivity currentActivity = (com.unity3d.player.UnityPlayerActivity)fCurrentActivity.get(null); 
    ret.playerActivity = currentActivity; 

    Field fPlayer = currentActivity.getClass().getDeclaredField("mUnityPlayer"); 
    fPlayer.setAccessible(true); 
    com.unity3d.player.UnityPlayer player = (com.unity3d.player.UnityPlayer)fPlayer.get(currentActivity); 
    ret.player = player; 

    Field f = player.getClass().getDeclaredField("y"); 
    f.setAccessible(true); 
    java.util.ArrayList cameraArrays = (java.util.ArrayList)f.get(player); 
    int sz = cameraArrays.size(); 

次に、(カメラのキャプチャキットから撮影)このような何か

関連する問題