imgutils.edge.canny
- Overview:
Get edge with
cv2.Canny
.Having the fastest running speed and the lowest system resource overhead.
get_edge_by_canny
- imgutils.edge.canny.get_edge_by_canny(image: str | PathLike | bytes | bytearray | BinaryIO | Image, low_threshold=100, high_threshold=200)[source]
- Overview:
Get edge mask with
cv2.Canny
.
- Parameters:
image – Original image (assuming its size is
HxW
).low_threshold – Low threshold of canny, default is
100
.high_threshold – High threshold of canny, default is
200
.
- Returns:
A mask with format
float32[H, W]
.
edge_image_with_canny
- imgutils.edge.canny.edge_image_with_canny(image: str | PathLike | bytes | bytearray | BinaryIO | Image, low_threshold=100, high_threshold=200, backcolor: str = 'white', forecolor: str | None = None) Image [source]
- Overview:
Get an image with the extracted edge from
image
.
- Parameters:
image – Original image (assuming its size is
HxW
).low_threshold – Low threshold of canny, default is
100
.high_threshold – High threshold of canny, default is
200
.backcolor – Background color the target image. Default is
white
. Whentransparent
is given, the background will be transparent.forecolor – Fore color of the target image. Default is
None
which means use the color from the givenimage
.
- Returns:
An image with the extracted edge from
image
.
- Examples::