|
|
|
@ -5,15 +5,15 @@ import torch |
|
|
|
from PIL import Image |
|
|
|
from PIL import Image |
|
|
|
import numpy as np |
|
|
|
import numpy as np |
|
|
|
import SpoutGL |
|
|
|
import SpoutGL |
|
|
|
from OpenGL.GL import GL_RGBA |
|
|
|
from OpenGL.GL import GL_RGBA, GL_BGRA |
|
|
|
import time |
|
|
|
import time |
|
|
|
import img2img |
|
|
|
import img2img |
|
|
|
from multiprocessing import Queue |
|
|
|
from multiprocessing import Queue |
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
def main(): |
|
|
|
TARGET_FPS = 60 |
|
|
|
TARGET_FPS = 60 |
|
|
|
SPOUT_RECEIVER_NAME = "Spout DX11 Sender" |
|
|
|
SPOUT_RECEIVER_NAME = "NoiseSender" |
|
|
|
SPOUT_SENDER_NAME = "Output - StreamDiffusion" |
|
|
|
SPOUT_SENDER_NAME = "StreamDiffusionSender" |
|
|
|
WIDTH = 512 |
|
|
|
WIDTH = 512 |
|
|
|
HEIGHT = 512 |
|
|
|
HEIGHT = 512 |
|
|
|
PROMPT = "a beautiful landscape painting, trending on artstation, 8k, hyperrealistic" |
|
|
|
PROMPT = "a beautiful landscape painting, trending on artstation, 8k, hyperrealistic" |
|
|
|
@ -82,7 +82,7 @@ def main(): |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
image_rgb_array = image_bgra[:, :, [2,1,0]] |
|
|
|
image_rgb_array = image_bgra[:, :, [2,1,0]] |
|
|
|
# image_rgb_array = image_rgb_array.astype(np.float32) / 255.0 |
|
|
|
image_rgb_array = (image_rgb_array+ 1.0 )/2.0 |
|
|
|
input_image = Image.fromarray(image_rgb_array, 'RGB') |
|
|
|
input_image = Image.fromarray(image_rgb_array, 'RGB') |
|
|
|
# input_image.save("debug_input.png") |
|
|
|
# input_image.save("debug_input.png") |
|
|
|
|
|
|
|
|
|
|
|
@ -100,7 +100,9 @@ def main(): |
|
|
|
# output_rgba_array = np.array(output_image.convert("RGBA")) |
|
|
|
# output_rgba_array = np.array(output_image.convert("RGBA")) |
|
|
|
# output_bgra_array = output_rgba_array[:, :, [2, 1, 0, 3]] |
|
|
|
# output_bgra_array = output_rgba_array[:, :, [2, 1, 0, 3]] |
|
|
|
# buffer = np.ascontiguousarray(output_bgra_array) |
|
|
|
# buffer = np.ascontiguousarray(output_bgra_array) |
|
|
|
output_bgr_array = np.array(output_image, dtype=np.uint8)[:, :, ::-1] |
|
|
|
# output_bgr_array = np.array(output_image, dtype=np.uint8)[:, :, ::-1] |
|
|
|
|
|
|
|
output_bgr_array=np.array(output_image) |
|
|
|
|
|
|
|
|
|
|
|
output_bgra_array = np.zeros((HEIGHT, WIDTH, 4), dtype=np.uint8) |
|
|
|
output_bgra_array = np.zeros((HEIGHT, WIDTH, 4), dtype=np.uint8) |
|
|
|
output_bgra_array[:, :, :3] = output_bgr_array |
|
|
|
output_bgra_array[:, :, :3] = output_bgr_array |
|
|
|
output_bgra_array[:, :, 3] = 255 |
|
|
|
output_bgra_array[:, :, 3] = 255 |
|
|
|
|