I really need some help to understand Python and class.
I'm defining an ImageProcessing Class with several methods.
class ImageProcessing:
"""
Class containing different processing operations
"""
def __init__(self, name, height, width):
""" Defining name, height and width of image processing object """
self.name = name
self.height = height
self.width = width
# several methods here with def.
# These methods mainly used some open cv operations.
def masking(self):
""" Method to mask | All masks are applied manually
- self MUST BE a numpy array or a scalar
"""
mask = cv2.rectangle(self, (0,0), (250,1200), (0,0,0), -1)
return(mask)
When I create an object, it is defined as belonging to ImageProcessing Class.
diff = ImageProcessing("diff",1200,1600)
diff = diff.masking()
And so this object called "diff" could not used my others methods, such as masking, defined in my class ImageProcessing because these methods are waiting for scalar or arrays to be used and the type of my object is ImageProcessing one.
I'm lost guys! Need some help on this basic things. How can I defined an object in a Class and giving it the right to be used by array methods (methods which are located in the same class)?