Android 呼叫攝像頭

2021-09-03 02:40:22 字數 771 閱讀 2019

androidmanifest新增許可權

intent呼叫開啟照相機:

intent intent = new intent(mediastore.action_image_capture);

file file = new file(environment.getexternalstoragedirectory().getpath(),"test.png");

//設定儲存**的位置

intent.putextra(mediastore.extra_output, uri.fromfile(file));

//開啟系統的照相機應用

startactivityforresult(intent, 1);

intent呼叫開啟攝像機:

//建立意圖

intent intent = new intent(mediastore.action_video_capture);

file file = new file(environment.getexternalstoragedirectory().getpath(),"test1.3gp");

//設定儲存**的位置

intent.putextra(mediastore.extra_output, uri.fromfile(file));

//開啟系統的照相機應用

startactivityforresult(intent, 2);

Python呼叫攝像頭

如下 import cv2 import numpy 建立攝像頭物件 cap cv2.videocapture videotest test1.mp4 cap cv2.videocapture 0 引數為本地攝像頭 cap cv2.videocapture 1 引數為usb攝像頭 while 1 r...

ffmpeg nginx dash呼叫攝像頭直播

參考 nginx安裝,需原始碼編譯,因為需要新增nginx rtmp module 模組 其次nginx的版本不要太低,以免make的時候出錯。安裝依賴 sudo apt get update sudo apt get install libpcre3 libpcre3 dev sudo apt g...

Android攝像頭呼叫和裁剪壓縮

廢話不多說,直接上原始碼 public class mainactivity extends activity private string filename private uri imguri private file img public void go view view 3 每一張新的名字...