mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-07-12 16:13:52 -07:00
StreamOutput: additional output modes
This commit is contained in:
parent
9342ada240
commit
639ceb3597
2 changed files with 28 additions and 6 deletions
|
@ -35,11 +35,14 @@ class StreamOutput(BackendHost):
|
||||||
def get_control_sheet(self) -> 'Sheet.Host': return super().get_control_sheet()
|
def get_control_sheet(self) -> 'Sheet.Host': return super().get_control_sheet()
|
||||||
|
|
||||||
class SourceType(IntEnum):
|
class SourceType(IntEnum):
|
||||||
ALIGNED_FACE = 0
|
SOURCE_FRAME = 0
|
||||||
SWAPPED_FACE = 1
|
ALIGNED_FACE = 1
|
||||||
MERGED_FRAME = 2
|
SWAPPED_FACE = 2
|
||||||
|
MERGED_FRAME = 3
|
||||||
|
SOURCE_N_MERGED_FRAME = 4
|
||||||
|
|
||||||
ViewModeNames = ['@StreamOutput.SourceType.ALIGNED_FACE', '@StreamOutput.SourceType.SWAPPED_FACE', '@StreamOutput.SourceType.MERGED_FRAME']
|
ViewModeNames = ['@StreamOutput.SourceType.SOURCE_FRAME', '@StreamOutput.SourceType.ALIGNED_FACE', '@StreamOutput.SourceType.SWAPPED_FACE',
|
||||||
|
'@StreamOutput.SourceType.MERGED_FRAME', '@StreamOutput.SourceType.SOURCE_N_MERGED_FRAME']
|
||||||
|
|
||||||
|
|
||||||
class StreamOutputWorker(BackendWorker):
|
class StreamOutputWorker(BackendWorker):
|
||||||
|
@ -197,8 +200,10 @@ class StreamOutputWorker(BackendWorker):
|
||||||
buffered_frames = self.buffered_frames
|
buffered_frames = self.buffered_frames
|
||||||
|
|
||||||
view_image = None
|
view_image = None
|
||||||
|
|
||||||
if source_type == SourceType.MERGED_FRAME:
|
if source_type == SourceType.SOURCE_FRAME:
|
||||||
|
view_image = bcd.get_image(bcd.get_frame_name())
|
||||||
|
elif source_type == SourceType.MERGED_FRAME:
|
||||||
view_image = bcd.get_image(bcd.get_merged_frame_name())
|
view_image = bcd.get_image(bcd.get_merged_frame_name())
|
||||||
|
|
||||||
elif source_type == SourceType.ALIGNED_FACE:
|
elif source_type == SourceType.ALIGNED_FACE:
|
||||||
|
@ -218,6 +223,13 @@ class StreamOutputWorker(BackendWorker):
|
||||||
if face_swap is not None:
|
if face_swap is not None:
|
||||||
view_image = bcd.get_image(face_swap.get_image_name())
|
view_image = bcd.get_image(face_swap.get_image_name())
|
||||||
break
|
break
|
||||||
|
|
||||||
|
elif source_type == SourceType.SOURCE_N_MERGED_FRAME:
|
||||||
|
source_frame = ImageProcessor(bcd.get_image(bcd.get_frame_name())).to_ufloat32().get_image('HWC')
|
||||||
|
merged_frame = bcd.get_image(bcd.get_merged_frame_name())
|
||||||
|
|
||||||
|
view_image = np.concatenate( (source_frame, merged_frame), 1 )
|
||||||
|
|
||||||
|
|
||||||
if view_image is not None:
|
if view_image is not None:
|
||||||
buffered_frames.add_buffer( bcd.get_frame_timestamp(), view_image )
|
buffered_frames.add_buffer( bcd.get_frame_timestamp(), view_image )
|
||||||
|
|
|
@ -681,6 +681,11 @@ class Localization:
|
||||||
'en-US' : 'Source*Celeb',
|
'en-US' : 'Source*Celeb',
|
||||||
'ru-RU' : 'Исходный*Знаменитость',
|
'ru-RU' : 'Исходный*Знаменитость',
|
||||||
'zh-CN' : '源脸*目标脸'},
|
'zh-CN' : '源脸*目标脸'},
|
||||||
|
|
||||||
|
'StreamOutput.SourceType.SOURCE_FRAME':{
|
||||||
|
'en-US' : 'Source frame',
|
||||||
|
'ru-RU' : 'Исходный кадр',
|
||||||
|
'zh-CN' : 'Source frame(没有翻译)'},
|
||||||
|
|
||||||
'StreamOutput.SourceType.ALIGNED_FACE':{
|
'StreamOutput.SourceType.ALIGNED_FACE':{
|
||||||
'en-US' : 'Aligned face',
|
'en-US' : 'Aligned face',
|
||||||
|
@ -697,4 +702,9 @@ class Localization:
|
||||||
'ru-RU' : 'Склеенный кадр',
|
'ru-RU' : 'Склеенный кадр',
|
||||||
'zh-CN' : '合成后的画面'},
|
'zh-CN' : '合成后的画面'},
|
||||||
|
|
||||||
|
'StreamOutput.SourceType.SOURCE_N_MERGED_FRAME':{
|
||||||
|
'en-US' : 'Source and merged frame',
|
||||||
|
'ru-RU' : 'Исходный и склеенный кадр',
|
||||||
|
'zh-CN' : 'Source and merged frame(没有翻译)'},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue