Comments (9)
This worked fine:
import numpy as np
import cv2
imgSize = (112, 96)
x_ = [30.2946, 65.5318, 48.0252, 33.5493, 62.7299]
y_ = [51.6963, 51.5014, 71.7366, 92.3655, 92.2041]
src = np.array( zip(x_, y_) ).astype(np.float32).reshape(1,5,2)
alignedFaces = []
# there might be more than one faces, hence
# multiple sets of points
for pset in points:
img2 = img.copy()
pset_x = pset[0:5]
pset_y = pset[5:10]
dst = np.array( zip(pset_x, pset_y) ).astype(np.float32).reshape(1,5,2)
transmat = cv2.estimateRigidTransform( dst, src, False )
out = cv2.warpAffine(img2, transmat, (imgSize[1], imgSize[0]))
alignedFaces.append(out)
from mtcnn.
you can refer to my article: here
from mtcnn.
Good for you.
from mtcnn.
Hi @DuinoDu ,
I found transmat = cv2.estimateRigidTransform( dst, src, False ) sometimes return None when the face is side face. But transf = cp2tform(coord5point_ori, coord5point_fixed, 'similarity') can work well. Could you give some help?
from mtcnn.
Hi, @xizi. Where do you find "transmat = cv2.estimateRigidTransform( dst, src, False ) "?
Can you provide url?
from mtcnn.
It is kizilkanat provide it from above and i have solved this problem by use "transmat = cv2.estimateRigidTransform( dst, src, True ) ". Thanks for your reply.
from mtcnn.
Good for you.
from mtcnn.
It's very helpful! Thanks, nttstar.
from mtcnn.
Hey guys, I just saw @nttstar have 25% better results with skimage SimilarityTransform than OpenCV estimateRigidTransform.
That's insane! The aligned images from 2 methods totally looks the same.
Does skimage do any difference things with its function, compare with Opencv?
I do want to use skimage SimilarityTransform in C++, Java also but skimage doesn't support. Do you guys know any which can use in C++, Java but strong liked skimage?
from mtcnn.
Related Issues (20)
- Is it possible to use it without matlab_wrapper? HOT 2
- Bounding box has 5 components HOT 1
- Missing Error.txt file HOT 1
- ROC on FDDB question HOT 3
- Understanding cascading of sizes in mtcnn HOT 3
- How can I modify the batch size when I want to detect more images each one time?
- Why the results from python and matlab are different? HOT 1
- why an data blob be reshapeed to 1,3,ws,hs HOT 2
- about speed
- Gtk-CRITICAL **: gtk_widget_new HOT 3
- demo.py script failing in GPU mode
- 关于绘制PR曲线
- demo.py中的代码错误
- How to get more points of the landmarks
- 当PNet检测到一个超过阈值的anchor时,为什么要做转置? HOT 2
- 你好,使用你提供的模型结果和作者matlab测试结果不一样
- No training code?
- In function generateBoundingBox, why plus 1?
- Why nobody is providing training code for mtcnn ?
- Training code?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mtcnn.