i
This commit is contained in:
parent
6bd69367aa
commit
bc4b420071
@ -82,9 +82,9 @@ def get_previewer(device, latent_format):
|
||||
x_sample = x_sample.cpu().numpy().clip(0, 255).astype(np.uint8)
|
||||
for i, s in enumerate(x_sample):
|
||||
if i > 0:
|
||||
show_preview(s, title=f'Preview Image {i}, step = [{step}/{total_steps}')
|
||||
show_preview(f'cv2_preview_{i}', s, title=f'Preview Image {i}, step = [{step}/{total_steps}')
|
||||
else:
|
||||
show_preview(s, title=f'Preview Image, step = {step}/{total_steps}')
|
||||
show_preview(f'cv2_preview_{i}', s, title=f'Preview Image, step = {step}/{total_steps}')
|
||||
|
||||
taesd.preview = preview_function
|
||||
|
||||
|
||||
@ -2,12 +2,11 @@ import threading
|
||||
import cv2
|
||||
|
||||
|
||||
flag = 'fooocus_cv2win32'
|
||||
buffer = []
|
||||
|
||||
|
||||
def worker():
|
||||
global buffer, flag
|
||||
global buffer
|
||||
while True:
|
||||
cv2.waitKey(50)
|
||||
try:
|
||||
@ -16,7 +15,7 @@ def worker():
|
||||
if task is None:
|
||||
cv2.destroyAllWindows()
|
||||
else:
|
||||
img, title = task
|
||||
flag, img, title = task
|
||||
cv2.imshow(flag, img)
|
||||
cv2.setWindowTitle(flag, title)
|
||||
cv2.setWindowProperty(flag, cv2.WND_PROP_TOPMOST, 1)
|
||||
@ -25,8 +24,8 @@ def worker():
|
||||
pass
|
||||
|
||||
|
||||
def show_preview(img, title='preview'):
|
||||
buffer.append((img, title))
|
||||
def show_preview(flag, img, title='preview'):
|
||||
buffer.append((flag, img.copy(), title))
|
||||
|
||||
|
||||
def close_all_preview():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user