We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello!
Q1、In the 8_generate_posmap_300WLP.py file, does the following code perform affine transformation and calculate the tfrom matrix?
kpt = image_vertices[bfm.kpt_ind, :].astype(np.int32) left = np.min(kpt[:, 0]) right = np.max(kpt[:, 0]) top = np.min(kpt[:, 1]) bottom = np.max(kpt[:, 1]) center = np.array([right - (right - left) / 2.0 ,bottom - (bottom - top) / 2.0]) old_size = (right - left + bottom - top)/2 size = int(old_size*1.5) # random pertube. you can change the numbers marg = old_size*0.1 t_xv = np.random.rand()*marg*2 - marg t_y = np.random.rand()*marg*2 - marg center[0] = center[0]+t_x; center[1] = center[1]+t_y size = size*(np.random.rand()*0.2 + 0.9) # crop and record the transform parameters src_pts = np.array([[center[0]-size/2, center[1]-size/2], [center[0] - size/2, center[1]+size/2], [center[0]+size/2, center[1]-size/2]]) DST_PTS = np.array([[0, 0], [0, image_h - 1], [image_w - 1, 0]]) tform = skimage.transform.estimate_transform('similarity', src_pts, DST_PTS)
kpt = image_vertices[bfm.kpt_ind, :].astype(np.int32)
left = np.min(kpt[:, 0])
right = np.max(kpt[:, 0])
top = np.min(kpt[:, 1])
bottom = np.max(kpt[:, 1])
center = np.array([right - (right - left) / 2.0 ,bottom - (bottom - top) / 2.0])
old_size = (right - left + bottom - top)/2
size = int(old_size*1.5)
# random pertube. you can change the numbers
marg = old_size*0.1
t_xv = np.random.rand()*marg*2 - marg
t_y = np.random.rand()*marg*2 - marg
center[0] = center[0]+t_x; center[1] = center[1]+t_y
size = size*(np.random.rand()*0.2 + 0.9)
# crop and record the transform parameters
src_pts = np.array([[center[0]-size/2, center[1]-size/2], [center[0] - size/2, center[1]+size/2], [center[0]+size/2, center[1]-size/2]])
DST_PTS = np.array([[0, 0], [0, image_h - 1], [image_w - 1, 0]])
tform = skimage.transform.estimate_transform('similarity', src_pts, DST_PTS)
Q2、So how to calculate the inverse_tfrom matrix of the inverse affine transformation? Thanks!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello!
Q1、In the 8_generate_posmap_300WLP.py file, does the following code perform affine transformation and calculate the tfrom matrix?
kpt = image_vertices[bfm.kpt_ind, :].astype(np.int32)
left = np.min(kpt[:, 0])
right = np.max(kpt[:, 0])
top = np.min(kpt[:, 1])
bottom = np.max(kpt[:, 1])
center = np.array([right - (right - left) / 2.0 ,bottom - (bottom - top) / 2.0])
old_size = (right - left + bottom - top)/2
size = int(old_size*1.5)
# random pertube. you can change the numbers
marg = old_size*0.1
t_xv = np.random.rand()*marg*2 - marg
t_y = np.random.rand()*marg*2 - marg
center[0] = center[0]+t_x; center[1] = center[1]+t_y
size = size*(np.random.rand()*0.2 + 0.9)
# crop and record the transform parameters
src_pts = np.array([[center[0]-size/2, center[1]-size/2], [center[0] - size/2, center[1]+size/2], [center[0]+size/2, center[1]-size/2]])
DST_PTS = np.array([[0, 0], [0, image_h - 1], [image_w - 1, 0]])
tform = skimage.transform.estimate_transform('similarity', src_pts, DST_PTS)
Q2、So how to calculate the inverse_tfrom matrix of the inverse affine transformation?
Thanks!
The text was updated successfully, but these errors were encountered: