Face Recognition [how to piece wise warp an image in opencv]

1,589 views
Skip to first unread message

OpenCV_Beginner99

unread,
Sep 21, 2011, 3:13:51 AM9/21/11
to android-opencv
Kindly help by sharing knowledge regarding how to piece wise warp an
image in opencv?

Thank You

Kirill Kornyakov

unread,
Sep 21, 2011, 5:01:45 AM9/21/11
to android...@googlegroups.com
Please try remap function.

OpenCV_Beginner99

unread,
Sep 22, 2011, 2:58:53 AM9/22/11
to android...@googlegroups.com


thank you.

OpenCV_Beginner99

unread,
Sep 25, 2011, 2:43:18 PM9/25/11
to android-opencv
Hi Kirill,

Thanks for your response.

I tried Imgproc.warpAffine first to piece wise warp the picture. I got
the triangles on the image by applying delaunay, then on each triangle
applied Imgproc.warpAffine. The output is rotated and resized image.
Remap on the other hand generates horizontal and vertical mirror
images.

I want to perform piece wise warping to change a portion of image not
the whole image. For eg. change the distance between the eyes, stretch
the nose. Please let me know which opencv method would be useful.

On Sep 21, 2:01 pm, Kirill Kornyakov <kirill.kornya...@itseez.com>
wrote:
> Please try remap<http://opencv.itseez.com/trunk/modules/imgproc/doc/geometric_transfor...>
>  function.

Kirill Kornyakov

unread,
Sep 26, 2011, 4:02:26 AM9/26/11
to android...@googlegroups.com
You really need to use remap function. Check this: http://opencv.itseez.com/trunk/doc/tutorials/imgproc/imgtrans/remap/remap.html#remap. Yes, they actually do only simple transformations, but they use simple maps! If you want something non-linear, you should create sophisticated map. Unfortunately I don't have a sample, but you can try to read this: http://opencv.itseez.com/trunk/doc/tutorials/calib3d/camera_calibration/camera_calibration.html#cameracalibrationopencv. Here they apply non-linear map to make the chessboard flat.

-Kirill

OpenCV_Beginner99

unread,
Sep 27, 2011, 7:22:15 AM9/27/11
to android-opencv

Hi,

To be more specific: The application that Im developing, gets the
average of two images.(Warps one image to match the another)
I read plenty of docs specifying the steps.

To refer one - https://ccrma.stanford.edu/~jacobliu/368Report/index.html

Here they have mentioned
"Perform coordinate transformations on the partitioned images to match
the feature points of these two images. Here, we are matching the eyes
and the mouths for these two images."

I have achieved image partitioning through delaunay. According to you
its remap that should be used for coordinate transformation.

But how to specify the input maps for remapping. All I have is
triangles based on feature points of the two input images. How to
remap one image based on the feature points of another?
Do I have to start from scratch again?

On Sep 26, 1:02 pm, Kirill Kornyakov <kirill.kornya...@itseez.com>
wrote:
> You really need to use remap function. Check this:http://opencv.itseez.com/trunk/doc/tutorials/imgproc/imgtrans/remap/r....
> Yes, they actually do only simple transformations, but they use simple maps!
> If you want something non-linear, you should create sophisticated map.
> Unfortunately I don't have a sample, but you can try to read this:http://opencv.itseez.com/trunk/doc/tutorials/calib3d/camera_calibrati....

OpenCV_Beginner99

unread,
Sep 30, 2011, 5:43:12 AM9/30/11
to android-opencv
Kindly share your knowledge ..........plz.

Thank you.

On Sep 27, 4:22 pm, OpenCV_Beginner99 <vinoygeorg...@gmail.com> wrote:
> Hi,
>
> To be more specific: The application that Im developing, gets the
> average of two images.(Warps one image to match the another)
> I read plenty of docs specifying the steps.
>
> To refer one -https://ccrma.stanford.edu/~jacobliu/368Report/index.html

Kirill Kornyakov

unread,
Sep 30, 2011, 9:37:13 AM9/30/11
to android...@googlegroups.com
I think you should try to ask at major OpenCV group. Face Morphing is a good task and it will take some time to build appropriate coordinate transformation maps. And probably remap is not the simplest way. Perhaps better to split your image into multiple images with only one face triangle and then call warpAffine function. But I think that finding an affine transform is comparable with the map calculation.

Here are some related threads from OpenCV group:

May be some other...
Reply all
Reply to author
Forward
0 new messages