Module brevettiai.data.image.image_processor

Expand source code
import numpy as np

from pydantic import BaseModel


class ImageProcessor(BaseModel):
    """
    Baseclass for implementing interface for image proccessors
    """
    type: str

    def process(self, image):
        """Process image according to processor"""
        raise NotImplementedError("process(image)-> image should be implemented")
        # noinspection PyUnreachableCode
        return image

    @staticmethod
    def affine_transform(input_height, input_width):
        return np.eye(3)

Classes

class ImageProcessor (**data: Any)

Baseclass for implementing interface for image proccessors

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ImageProcessor(BaseModel):
    """
    Baseclass for implementing interface for image proccessors
    """
    type: str

    def process(self, image):
        """Process image according to processor"""
        raise NotImplementedError("process(image)-> image should be implemented")
        # noinspection PyUnreachableCode
        return image

    @staticmethod
    def affine_transform(input_height, input_width):
        return np.eye(3)

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Subclasses

Class variables

var type : str

Static methods

def affine_transform(input_height, input_width)
Expand source code
@staticmethod
def affine_transform(input_height, input_width):
    return np.eye(3)

Methods

def process(self, image)

Process image according to processor

Expand source code
def process(self, image):
    """Process image according to processor"""
    raise NotImplementedError("process(image)-> image should be implemented")
    # noinspection PyUnreachableCode
    return image