Android Camera API ISO Setting?

前端 未结 5 1843
一个人的身影
一个人的身影 2020-12-05 09:12

Would anyone know where to control the ISO setting for the camera from in the Android SDK ? It should be possible as the native camera application on the HTC Desire has ISO

5条回答
  •  感情败类
    2020-12-05 09:26

    By now (KK 4.4.2) android has no official APIs to manage ISO.
    ISO management is a totally device dependant matter, and 8/18 devices i tested so far doesn't support ISO settings at all.
    Investigate Camera.getParameters().flatten() String to check valid keywords, every device can use different keywords!!
    Most devices use "iso-values" keyword to define a comma separated list-of-possible-values to use with "iso" keyword, like this:

    param.set("iso", valid_value_from_list);
    

    Some other devices uses "iso-mode-values" and "iso" keywords (Galaxy Nexus).
    I found also a device that uses "iso-speed-values" and "iso-speed" (Micromax A101).
    Another one that make me sad is "nv-picture-iso-values" -> "nv-picture-iso" (LG dual P990).

    Follow szia answer on how to use these keywords.

    Here's some code i use to get a list of valid values using known keywords:

    String flat = param.flatten();
    String[] isoValues = null;
    String values_keyword=null;
    String iso_keyword=null;
    if(flat.contains("iso-values")) {
        // most used keywords
        values_keyword="iso-values";
        iso_keyword="iso";
    } else if(flat.contains("iso-mode-values")) {
        // google galaxy nexus keywords
        values_keyword="iso-mode-values";
        iso_keyword="iso";
    } else if(flat.contains("iso-speed-values")) {
        // micromax a101 keywords
        values_keyword="iso-speed-values";
        iso_keyword="iso-speed";
    } else if(flat.contains("nv-picture-iso-values")) {
        // LG dual p990 keywords
        values_keyword="nv-picture-iso-values";
        iso_keyword="nv-picture-iso";
    }
    // add other eventual keywords here...
    if(iso_keyword!=null) {
        // flatten contains the iso key!!
        String iso = flat.substring(flat.indexOf(values_keyword));
        iso = iso.substring(iso.indexOf("=")+1);
    
        if(iso.contains(";")) iso = iso.substring(0, iso.indexOf(";"));
    
        isoValues = iso.split(",");
    
    } else {
        // iso not supported in a known way
    }
    

提交回复
热议问题