Reputation: 793
In my project, I want to set 4 cropping points manually on an image and crop that image according to set points. For example have a look on below image.
Like this, all I want is to crop the image according to that path and after cropping it should be a rectangle. This is just like image cropping in CamScanner IOS application. If anyone have any idea how to do this any help would be highly appreciated.
Upvotes: 2
Views: 3892
Reputation: 129
I think you need geometric_transformations.
If you plan to use opencv, here is a good example: http://www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/
Upvotes: 1
Reputation: 49730
Here are found very nice github project that have same funtionality what you want but this is in Objective-C might be you can convert this code in to swift check the link following:
https://github.com/jberlana/JBCroppableView
It's output is:
UPDATE
I just made one Demo in Swift using JBCroppableView Objective-C class implements in Swift. Download from the following and use as per your requirement.
https://github.com/nitingohel/NGCropview
The Combination of Swift + Objective-C
OUTPUT
Upvotes: 3