Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always return cv:Mat() #14

Closed
rootkit opened this issue Nov 5, 2017 · 11 comments
Closed

always return cv:Mat() #14

rootkit opened this issue Nov 5, 2017 · 11 comments

Comments

@rootkit
Copy link

rootkit commented Nov 5, 2017

when the app run here:
cv::Mat FaceSwap::blend(const cv::Mat& src, const cv::Mat& dst, const cv::Mat& dst_seg)
if (minc >= maxc || minr >= maxr) return cv::Mat();

blend always return cv:Mat(), I don't know what happen?
BTW: I finish port the great app to iOS platform, in the end run here and stop, return failstd::runtime_error: Face swap failed!

Thanks

John

@YuvalNirkin
Copy link
Owner

This means that the combined segmentation map is only zeros.
It might be a problem with the landmarks or the segmentation.

I like the idea of an iOS port! It can be a great contribution! Are you willing to share the code?

@rootkit
Copy link
Author

rootkit commented Nov 9, 2017

the log:
faces found = 1
faces found = 1
vecR [0.0029098843;
0.15772882;
-0.037092187]
vecT [1.9298197;
-21.032534;
-1098.7878]
exprW [-0.39331913;
0.17700461;
-0.29514793;
0.11593564;
-0.42752558;
0.24469842;
2.8671944;
0.7221989;
-1.1991261;
0.099073336;
0.20576096;
1.0124749;
-0.44310626;
-0.098507486;
-1.0734005;
-0.24701883;
-0.37821278;
0.3187601;
1.1587392;
1.8510281;
1.3205831;
0.76069188;
-0.029121373;
-0.0070772283;
1.1604365;
0.0073522874;
0.24649803;
-0.02893436;
-0.24754204]
vecR [-0.034498993;
0.077174194;
-0.13330679]
vecT [4.0268807;
-32.977039;
-924.23651]
exprW [-0.24939266;
0.39104307;
-0.17418325;
0.77485698;
-0.11051087;
0.25302994;
1.5111284;
-1.7924082;
-0.21672148;
-0.19027816;
-0.27793592;
1.3636755;
0.03324154;
-0.012820265;
-1.6727974;
-0.12949848;
-0.047394246;
0.91332167;
0.16732536;
0.04252547;
0.11279398;
0.49106297;
-0.008773597;
-0.21201798;
1.1952631;
0.24981749;
0.021493442;
-0.29385114;
-0.26967478]
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: Face swap failed!

I found here :
cv::Mat rendered_img;
m_face_renderer->render(m_vecR, m_vecT);
m_face_renderer->getFrameBuffer(rendered_img);
rendered_img data is zeros, I think the issues is here? Am I right?

I will share the porting code till the app can run on iOS, but I might not enough time to support the code.

@YuvalNirkin
Copy link
Owner

YuvalNirkin commented Nov 12, 2017

I can't track the problem from this log. What images have you used?

@rootkit
Copy link
Author

rootkit commented Nov 14, 2017

I import some debug images, as follows:
cv::Mat debug_src_mesh_img = fs.debugSourceMesh();
cv::Mat debug_tgt_mesh_img = fs.debugTargetMesh();
img_0195
img_0194

cv::Mat debug_src_lms_img = fs.debugSourceLandmarks();
cv::Mat debug_tgt_lms_img = fs.debugTargetLandmarks();
img_0201
img_0202

cv::Mat debug_src_mesh_wire_img = fs.debugSourceMeshWireframe();
cv::Mat debug_tgt_mesh_wire_img = fs.debugTargetMeshWireframe();
img_0219
img_0254

BTW: face segment need to big memory more then 1GB, I have to generate them by Mac OS APP
src
des

@rootkit
Copy link
Author

rootkit commented Nov 24, 2017

I found the rendered_img.data is zero, so opengles porting is not right?
m_face_renderer->render(m_vecR, m_vecT);
m_face_renderer->getFrameBuffer(rendered_img);

@YuvalNirkin
Copy link
Owner

What is the OpenGL ES version? It has to be equivalent to OpenGL 1.5 (without shaders).

@rootkit
Copy link
Author

rootkit commented Nov 25, 2017

#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>

@rootkit
Copy link
Author

rootkit commented Nov 25, 2017

I have to use opengl es1, delete es2.0, now I test it... god bless me

@rootkit
Copy link
Author

rootkit commented Nov 25, 2017

I already change opengl es2 to es1, no lucky:), rendered_img is still zero.
I ongly add a function beacause es2 does not provide it.
void gluPerspective(double fovy , double aspect , double zNear , double zFar)
{
// Start in projection mode.
//glMatrixMode(GL_PROJECTION);
//glLoadIdentity();
double xmin, xmax, ymin, ymax;
ymax = zNear * tan(fovy * M_PI / 360.0);
ymin = -ymax;
xmin = ymin * aspect;
xmax = ymax * aspect;
glFrustumf(xmin, xmax, ymin, ymax, zNear, zFar);
}

@rootkit
Copy link
Author

rootkit commented Nov 25, 2017

2017-11-25 2 45 24
2017-11-25 2 46 07
2017-11-25 2 47 19
2017-11-25 3 05 20
2017-11-25 3 05 31

Everything is ok but rendered_img:(

@rootkit
Copy link
Author

rootkit commented Nov 25, 2017

So how to trace the problem in the next step? do you need more screetshots about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants