tpys / face-everthing

face detection alignment recognition reconstruction ...
261 stars 102 forks source link

about find_none_flectives_similarity #15

Open lzg188 opened 6 years ago

lzg188 commented 6 years ago

thanks for your shared code, it is very good but about this function named find_none_flectives_similarity i can not understand well. like this code: xy(Rect(1, 0, 1, xy.rows)).copyTo(A(Rect(0, xy.rows, 1, xy.rows)));//y (xy(Rect(0, 0, 1, xy.rows))).copyTo(A(Rect(1, xy.rows, 1, xy.rows)));//-x A(Rect(1, xy.rows, 1, xy.rows)) *= -1; A(Rect(3, xy.rows, 1, xy.rows)).setTo(1.); what are you going to do with adding the -x to matrix A, and why to inv the matrix trans_inv? can you give me some explanation with that? waiting for you replay!!!

chinazy95 commented 3 years ago
  1. what are you going to do with adding the -x to matrix A You should learn the meaning of "find_none_flectives_similarity". It means only considerate about rotation, scale(same as x and y), and translation. % Try varying these 4 parameters. scale = 1.2; % scale factor angle = 40*pi/180; % rotation angle tx = 0; % x translation ty = 0; % y translation

sc = scalecos(angle); ss = scalesin(angle);

T = [ sc -ss 0; ss sc 0; tx ty 1]; so the transormed function worked: X = ax+by+c Y = -bx+ay+d

  1. why to inv the matrix trans_inv? trans = find_similarity(src, dst); trans1 =find_none_flectives_similarity(uv, xy); //uv is src,xy is dst cv::solve(A, b, x, cv::DECOMP_SVD); //A is dst, b is uv so the result is dst to src. We are figuring out the src to dst, so it should be inverted.