fix skimage import color
https://github.com/Sanster/lama-cleaner/issues/121
This commit is contained in:
parent
8c2904c9c8
commit
4f42dda2cf
@ -3,6 +3,7 @@ import time
|
|||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import skimage
|
import skimage
|
||||||
|
from skimage import color, feature
|
||||||
import torch
|
import torch
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
|
|
||||||
@ -157,8 +158,8 @@ def load_image(img, mask, device, sigma256=3.0):
|
|||||||
# https://scikit-image.org/docs/stable/api/skimage.feature.html#skimage.feature.canny
|
# https://scikit-image.org/docs/stable/api/skimage.feature.html#skimage.feature.canny
|
||||||
# low_threshold: Lower bound for hysteresis thresholding (linking edges). If None, low_threshold is set to 10% of dtype’s max.
|
# low_threshold: Lower bound for hysteresis thresholding (linking edges). If None, low_threshold is set to 10% of dtype’s max.
|
||||||
# high_threshold: Upper bound for hysteresis thresholding (linking edges). If None, high_threshold is set to 20% of dtype’s max.
|
# high_threshold: Upper bound for hysteresis thresholding (linking edges). If None, high_threshold is set to 20% of dtype’s max.
|
||||||
gray_256 = skimage.color.rgb2gray(img_256)
|
gray_256 = color.rgb2gray(img_256)
|
||||||
edge_256 = skimage.feature.canny(gray_256, sigma=sigma256, mask=None).astype(float)
|
edge_256 = feature.canny(gray_256, sigma=sigma256, mask=None).astype(float)
|
||||||
# cv2.imwrite("skimage_gray.jpg", (_gray_256*255).astype(np.uint8))
|
# cv2.imwrite("skimage_gray.jpg", (_gray_256*255).astype(np.uint8))
|
||||||
# cv2.imwrite("skimage_edge.jpg", (_edge_256*255).astype(np.uint8))
|
# cv2.imwrite("skimage_edge.jpg", (_edge_256*255).astype(np.uint8))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user