mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-20 13:33:24 -07:00
fix manual extractor crash
This commit is contained in:
parent
02331c301b
commit
77640259fc
1 changed files with 16 additions and 7 deletions
|
@ -116,8 +116,10 @@ class ExtractSubprocessor(SubprocessorBase):
|
||||||
self.original_image = cv2.imread(filename)
|
self.original_image = cv2.imread(filename)
|
||||||
|
|
||||||
(h,w,c) = self.original_image.shape
|
(h,w,c) = self.original_image.shape
|
||||||
|
|
||||||
self.view_scale = 1.0 if self.manual_window_size == 0 else self.manual_window_size / (w if w > h else h)
|
self.view_scale = 1.0 if self.manual_window_size == 0 else self.manual_window_size / (w if w > h else h)
|
||||||
self.original_image = cv2.resize (self.original_image, ( int(w*self.view_scale), int(h*self.view_scale) ), interpolation=cv2.INTER_LINEAR)
|
self.original_image = cv2.resize (self.original_image, ( int(w*self.view_scale), int(h*self.view_scale) ), interpolation=cv2.INTER_LINEAR)
|
||||||
|
(h,w,c) = self.original_image.shape
|
||||||
|
|
||||||
self.text_lines_img = (image_utils.get_draw_text_lines ( self.original_image, (0,0, self.original_image.shape[1], min(100, self.original_image.shape[0]) ),
|
self.text_lines_img = (image_utils.get_draw_text_lines ( self.original_image, (0,0, self.original_image.shape[1], min(100, self.original_image.shape[0]) ),
|
||||||
[ 'Match landmarks with face exactly.',
|
[ 'Match landmarks with face exactly.',
|
||||||
|
@ -137,13 +139,20 @@ class ExtractSubprocessor(SubprocessorBase):
|
||||||
is_frame_done = True
|
is_frame_done = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if self.param_x != self.param['x'] / self.view_scale or \
|
new_param_x = self.param['x'] / self.view_scale
|
||||||
self.param_y != self.param['y'] / self.view_scale or \
|
new_param_y = self.param['y'] / self.view_scale
|
||||||
self.param_rect_size != self.param['rect_size']:
|
new_param_rect_size = self.param['rect_size']
|
||||||
|
|
||||||
self.param_x = self.param['x'] / self.view_scale
|
new_param_x = np.clip (new_param_x, 0, w-1)
|
||||||
self.param_y = self.param['y'] / self.view_scale
|
new_param_y = np.clip (new_param_y, 0, h-1)
|
||||||
self.param_rect_size = self.param['rect_size']
|
|
||||||
|
if self.param_x != new_param_x or \
|
||||||
|
self.param_y != new_param_y or \
|
||||||
|
self.param_rect_size != new_param_rect_size:
|
||||||
|
|
||||||
|
self.param_x = new_param_x
|
||||||
|
self.param_y = new_param_y
|
||||||
|
self.param_rect_size = new_param_rect_size
|
||||||
|
|
||||||
self.rect = (self.param_x-self.param_rect_size, self.param_y-self.param_rect_size, self.param_x+self.param_rect_size, self.param_y+self.param_rect_size)
|
self.rect = (self.param_x-self.param_rect_size, self.param_y-self.param_rect_size, self.param_x+self.param_rect_size, self.param_y+self.param_rect_size)
|
||||||
return [filename, [self.rect]]
|
return [filename, [self.rect]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue