mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-16 00:04:35 +08:00
matplotlib optional as well
This commit is contained in:
parent
1afb92dee2
commit
2e7129fdb9
@ -4,11 +4,6 @@ from torchvision.transforms import functional as TF
|
|||||||
from PIL import Image, ImageDraw, ImageFilter, ImageFont
|
from PIL import Image, ImageDraw, ImageFilter, ImageFont
|
||||||
import scipy.ndimage
|
import scipy.ndimage
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
try:
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
except:
|
|
||||||
print("Matplotlib not installed")
|
|
||||||
from contextlib import nullcontext
|
from contextlib import nullcontext
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -712,6 +707,7 @@ class CreateMagicMask:
|
|||||||
|
|
||||||
def createmagicmask(self, frames, transitions, depth, distortion, seed, frame_width, frame_height):
|
def createmagicmask(self, frames, transitions, depth, distortion, seed, frame_width, frame_height):
|
||||||
from ..utility.magictex import coordinate_grid, random_transform, magic
|
from ..utility.magictex import coordinate_grid, random_transform, magic
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
rng = np.random.default_rng(seed)
|
rng = np.random.default_rng(seed)
|
||||||
out = []
|
out = []
|
||||||
coords = coordinate_grid((frame_width, frame_height))
|
coords = coordinate_grid((frame_width, frame_height))
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn.functional as F
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
@ -1510,6 +1508,7 @@ or a .txt file with RealEstate camera intrinsics and coordinates, in a 3D plot.
|
|||||||
|
|
||||||
def customize_legend(self, list_label):
|
def customize_legend(self, list_label):
|
||||||
from matplotlib.patches import Patch
|
from matplotlib.patches import Patch
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
list_handle = []
|
list_handle = []
|
||||||
for idx, label in enumerate(list_label):
|
for idx, label in enumerate(list_label):
|
||||||
color = plt.cm.rainbow(idx / len(list_label))
|
color = plt.cm.rainbow(idx / len(list_label))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user