Cropping a Perspective Transformation of Image on Android

前端 未结 2 911
温柔的废话
温柔的废话 2021-02-07 21:13

I\'m trying to do a perspective transform on a bitmap that I capture via the camera. The user adjusts a bounding quad (as depicted by the white box) around a rectangular object.

2条回答
  •  一向
    一向 (楼主)
    2021-02-07 21:30

    After you create your new Bitmap image, you can call Android's built in crop functionality by building a 'crop' intent and calling it, example:

    Intent cropIntent = new Intent("com.android.camera.action.CROP");
    
    // Put in 'Extras' here to build the intent
    
    // Start the activity. It will be handled by returning data to onActivityResult
    startActivityForResult(cropIntent, PIC_CROP); // PIC_CROP is just an arbitrary tag name.
    

    More detail about image cropping in Android can be attained from here.

    You will also need to add the following in your app's manifest file for this to work:

    
    
    

提交回复
热议问题