convert Bitmap to Mat after capture image using android camera

前端 未结 4 1137
傲寒
傲寒 2020-12-07 16:48
Mat b = new Mat();
Bitmap bmp = getIntent().getExtras().getParcelable(\"image_send\");

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCr         


        
4条回答
  •  -上瘾入骨i
    2020-12-07 17:41

    With Camera2 this task is very fast, only you need config the ImageReader with ImageFormat on YUV_420_888 and then proccess frames with OpenCV like this:

    // You can read image with differents patterns for example grayscale:
    Mat mGray(height, width, cv::IMREAD_GRAYSCALE, pFrameData); 
    

    A complete implementation in the next answer: https://stackoverflow.com/a/49331546/471690

提交回复
热议问题