{"id":2044,"date":"2018-08-20T23:19:34","date_gmt":"2018-08-20T15:19:34","guid":{"rendered":"http:\/\/www.magicandlove.com\/blog\/?p=2044"},"modified":"2018-08-20T23:19:34","modified_gmt":"2018-08-20T15:19:34","slug":"face-swap-example-in-opencv-with-processing-v-1","status":"publish","type":"post","link":"http:\/\/www.magicandlove.com\/blog\/2018\/08\/20\/face-swap-example-in-opencv-with-processing-v-1\/","title":{"rendered":"Face swap example in OpenCV with Processing (v.1)"},"content":{"rendered":"<p>After the previous 4 exercises, we can start to work on with the OpenCV face swap example in Processing. With the two images, we first compute the face landmark for each of them. We then prepare the Delaunay triangulation for the 2nd image.\u00a0 Based on the triangles in the 2nd image, we find corresponding vertices in the 1st image. For each triangle pair, we perform the warp affine transform from the 1st image to the 2nd image. It will create the face swap effect.<\/p>\n<p><a href=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/faceswap0001.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2045\" src=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/faceswap0001-300x100.png\" alt=\"\" width=\"300\" height=\"100\" srcset=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/faceswap0001-300x100.png 300w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/faceswap0001-768x256.png 768w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/faceswap0001.png 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Note the skin tone discrepancy in the 3rd image for the face swap.<\/p>\n<p>Full source code is now available at the GitHub repository <a href=\"https:\/\/github.com\/chungbwc\/Magicandlove\/tree\/master\/ml20180820a\" target=\"_blank\" rel=\"noopener\">ml20180820a<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After the previous 4 exercises, we can start to work on with the OpenCV face swap example in Processing. With the two images, we first compute the face landmark for each of them. We then prepare the Delaunay triangulation for the 2nd image.\u00a0 Based on the triangles in the 2nd image, we find corresponding vertices [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89,79],"tags":[43,3,62],"class_list":["post-2044","post","type-post","status-publish","format-standard","hentry","category-research","category-software-2","tag-face-detection","tag-opencv","tag-processing-org"],"_links":{"self":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/2044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/comments?post=2044"}],"version-history":[{"count":1,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/2044\/revisions"}],"predecessor-version":[{"id":2046,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/2044\/revisions\/2046"}],"wp:attachment":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/media?parent=2044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/categories?post=2044"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/tags?post=2044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}