jactorch.vision.morphology#

Classes

Functions

black_hat(image, kernel_size[, shape])

close(image, kernel_size[, shape])

dilate(image, kernel_size[, shape])

erode(image, kernel_size[, shape])

get_morphology_kernel(shape, kernel_size)

morph_grad(image, kernel_size[, shape])

open(image, kernel_size[, shape])

top_hat(image, kernel_size[, shape])

Class BlackHat

class BlackHat[source]#

Bases: MorphologyOp

__init__(kernel_size, shape='rect')#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)#
dilate(image)#
erode(image)#
forward(image)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_morphology(image, op=None)#
open(image)#

Class Closing

class Closing[source]#

Bases: MorphologyOp

__init__(kernel_size, shape='rect')#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)#
dilate(image)#
erode(image)#
forward(image)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_morphology(image, op=None)#
open(image)#

Class Dilation

class Dilation[source]#

Bases: MorphologyOp

__init__(kernel_size, shape='rect')#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)#
dilate(image)#
erode(image)#
forward(image)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_morphology(image, op=None)#
open(image)#

Class Erosion

class Erosion[source]#

Bases: MorphologyOp

__init__(kernel_size, shape='rect')#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)#
dilate(image)#
erode(image)#
forward(image)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_morphology(image, op=None)#
open(image)#

Class MorphologicalGradient

class MorphologicalGradient[source]#

Bases: MorphologyOp

__init__(kernel_size, shape='rect')#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)#
dilate(image)#
erode(image)#
forward(image)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_morphology(image, op=None)#
open(image)#

Class MorphologyKernelType

class MorphologyKernelType[source]#

Bases: JacEnum

__new__(value)#
classmethod assert_valid(value)#

Assert if the value is a valid choice.

classmethod choice_names()#

Returns the list of the name of all possible choices.

classmethod choice_objs()#

Returns the list of the object of all possible choices.

classmethod choice_values()#

Returns the list of the value of all possible choices.

classmethod from_string(value)#
Parameters:

value (str | JacEnum)

Return type:

JacEnum

classmethod is_valid(value)#

Check if the value is a valid choice.

classmethod type_name()#

Return the type name of the enum.

CROSS = 'cross'#
ELLIPSE = 'ellipse'#
RECT = 'rect'#

Class MorphologyOp

class MorphologyOp[source]#

Bases: Module

__init__(kernel_size, shape='rect')[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)[source]#
dilate(image)[source]#
erode(image)[source]#
forward_morphology(image, op=None)[source]#
open(image)[source]#

Class Opening

class Opening[source]#

Bases: MorphologyOp

__init__(kernel_size, shape='rect')#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)#
dilate(image)#
erode(image)#
forward(image)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_morphology(image, op=None)#
open(image)#

Class TopHat

class TopHat[source]#

Bases: MorphologyOp

__init__(kernel_size, shape='rect')#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

close(image)#
dilate(image)#
erode(image)#
forward(image)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_morphology(image, op=None)#
open(image)#

Functions

black_hat(image, kernel_size, shape='rect')[source]#
close(image, kernel_size, shape='rect')[source]#
dilate(image, kernel_size, shape='rect')[source]#
erode(image, kernel_size, shape='rect')[source]#
get_morphology_kernel(shape, kernel_size)[source]#
morph_grad(image, kernel_size, shape='rect')[source]#
open(image, kernel_size, shape='rect')[source]#
top_hat(image, kernel_size, shape='rect')[source]#