2017-10-04 3 views
-5

전면 카메라 캡처 이미지 만 가져 오려고합니다.전면 카메라 캡처 이미지 경로를 얻는 방법

날 전방 카메라 (셀카 카메라) 미리

덕분에 의해 캡처 된 모든 이미지 경로를 제공 어떤 목적 함수 또는 매체가있다.

+0

을이 링크가 도움이 https://stackoverflow.com/a/4495753/5580210 –

답변

1

나에게 전면 카메라 (셀카 카메라)로 촬영 된 모든 이미지의 경로를 제공 어떤 의도 나 미디어 기능이 있습니까

번호

+0

좋아, 감사의 정보. –

1

그것을 할 수있는 간단한 방법이 더이 있지만 DCIM 폴더의 각 사진에 대해 exif 메타 데이터를 가져온 다음 TAG_MODEL (또는 다른 특성)이 전면 카메라의 사양과 일치하는지 확인할 수 있습니다.

샘플 코드는 이미지 파일에서 exif 메타 데이터 (source) 얻을 : 내가 생각

public class AndroidExif extends Activity { 

TextView myTextView; 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     myTextView = (TextView)findViewById(R.id.textview); 

     //change with the filename & location of your photo file 
     String filename = "/sdcard/DSC_3509.JPG"; 
     try { 
    ExifInterface exif = new ExifInterface(filename); 
    ShowExif(exif); 
    } catch (IOException e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
    Toast.makeText(this, "Error!", 
    Toast.LENGTH_LONG).show(); 
    } 
    } 

    private void ShowExif(ExifInterface exif) 
    { 
    String myAttribute="Exif information ---\n"; 
    myAttribute += getTagString(ExifInterface.TAG_DATETIME, exif); 
    myAttribute += getTagString(ExifInterface.TAG_FLASH, exif); 
    myAttribute += getTagString(ExifInterface.TAG_GPS_LATITUDE, exif); 
    myAttribute += getTagString(ExifInterface.TAG_GPS_LATITUDE_REF, exif); 
    myAttribute += getTagString(ExifInterface.TAG_GPS_LONGITUDE, exif); 
    myAttribute += getTagString(ExifInterface.TAG_GPS_LONGITUDE_REF, exif); 
    myAttribute += getTagString(ExifInterface.TAG_IMAGE_LENGTH, exif); 
    myAttribute += getTagString(ExifInterface.TAG_IMAGE_WIDTH, exif); 
    myAttribute += getTagString(ExifInterface.TAG_MAKE, exif); 
    myAttribute += getTagString(ExifInterface.TAG_MODEL, exif); 
    myAttribute += getTagString(ExifInterface.TAG_ORIENTATION, exif); 
    myAttribute += getTagString(ExifInterface.TAG_WHITE_BALANCE, exif); 
    myTextView.setText(myAttribute); 
    } 

    private String getTagString(String tag, ExifInterface exif) 
    { 
    return(tag + " : " + exif.getAttribute(tag) + "\n"); 
    } 
} 
관련 문제