Search code examples
iosopencvmatrixgraphics2dmesh

transform specific area of image with mesh using opencv in ios


I want to stretch specific area(have four coordinates) to a target area without loosing rest of context. exactly like drawing a mesh and stretching any where compresses the mesh area of target direction and also i want to reverse if i want. And all these things will work on touch move. I am using pan gesture recognizer and i have the source coordinates and the i have calculated the destination coordinates according to the direction. But don't know how to draw mesh and achieve the stretching. I know i have to use open cv. But i have no idea how to use open cv in iOS. If any tutorial can help me then please send the links. I am trying to do exactly like this.

Image using stretch with mesh

I want to stretch when the user starts touch from white circle area and stretch towards top left corner.

After searching articles related to open cv and from the portal of open cv i found that i have to use open cv warp prospective function but not able to implement it. Any link for using open cv in iOS or using mesh in iOS will help a lot. Thanks.


Solution

  • I found this awesome third party called BCMeshTransform which helped me to achieve what i asked in question. Link below. Needed a lot of modifications using UIGestureRecognizer but the problem was solved.

    Link - https://github.com/Ciechan/BCMeshTransformView

    Thanks.