(self, rotate_pitch, rotate_yaw, rotate_roll, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile,
src_ratio, sample_ratio, sample_parts, crop_factor, src_image=None, sample_image=None, motion_link=None, add_exp=None)
| 882 | # OUTPUT_IS_LIST = (False,) |
| 883 | |
| 884 | def run(self, rotate_pitch, rotate_yaw, rotate_roll, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile, |
| 885 | src_ratio, sample_ratio, sample_parts, crop_factor, src_image=None, sample_image=None, motion_link=None, add_exp=None): |
| 886 | rotate_yaw = -rotate_yaw |
| 887 | |
| 888 | new_editor_link = None |
| 889 | if motion_link != None: |
| 890 | self.psi = motion_link[0] |
| 891 | new_editor_link = motion_link.copy() |
| 892 | elif src_image != None: |
| 893 | if id(src_image) != id(self.src_image) or self.crop_factor != crop_factor: |
| 894 | self.crop_factor = crop_factor |
| 895 | self.psi = g_engine.prepare_source(src_image, crop_factor) |
| 896 | self.src_image = src_image |
| 897 | new_editor_link = [] |
| 898 | new_editor_link.append(self.psi) |
| 899 | else: |
| 900 | return (None,None) |
| 901 | |
| 902 | pipeline = g_engine.get_pipeline() |
| 903 | |
| 904 | psi = self.psi |
| 905 | s_info = psi.x_s_info |
| 906 | #delta_new = copy.deepcopy() |
| 907 | s_exp = s_info['exp'] * src_ratio |
| 908 | s_exp[0, 5] = s_info['exp'][0, 5] |
| 909 | s_exp += s_info['kp'] |
| 910 | |
| 911 | es = ExpressionSet() |
| 912 | |
| 913 | if sample_image != None: |
| 914 | if id(self.sample_image) != id(sample_image): |
| 915 | self.sample_image = sample_image |
| 916 | d_image_np = (sample_image * 255).byte().numpy() |
| 917 | d_face = g_engine.crop_face(d_image_np[0], 1.7) |
| 918 | i_d = g_engine.prepare_src_image(d_face) |
| 919 | self.d_info = pipeline.get_kp_info(i_d) |
| 920 | self.d_info['exp'][0, 5, 0] = 0 |
| 921 | self.d_info['exp'][0, 5, 1] = 0 |
| 922 | |
| 923 | # "OnlyExpression", "OnlyRotation", "OnlyMouth", "OnlyEyes", "All" |
| 924 | if sample_parts == "OnlyExpression" or sample_parts == "All": |
| 925 | es.e += self.d_info['exp'] * sample_ratio |
| 926 | if sample_parts == "OnlyRotation" or sample_parts == "All": |
| 927 | rotate_pitch += self.d_info['pitch'] * sample_ratio |
| 928 | rotate_yaw += self.d_info['yaw'] * sample_ratio |
| 929 | rotate_roll += self.d_info['roll'] * sample_ratio |
| 930 | elif sample_parts == "OnlyMouth": |
| 931 | retargeting(es.e, self.d_info['exp'], sample_ratio, (14, 17, 19, 20)) |
| 932 | elif sample_parts == "OnlyEyes": |
| 933 | retargeting(es.e, self.d_info['exp'], sample_ratio, (1, 2, 11, 13, 15, 16)) |
| 934 | |
| 935 | es.r = g_engine.calc_fe(es.e, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile, |
| 936 | rotate_pitch, rotate_yaw, rotate_roll) |
| 937 | |
| 938 | if add_exp != None: |
| 939 | es.add(add_exp) |
| 940 | |
| 941 | new_rotate = get_rotation_matrix(s_info['pitch'] + es.r[0], s_info['yaw'] + es.r[1], |
nothing calls this directly
no test coverage detected