Skip to content

Target Detection: Support Multiple Colours #4

@jeffstjean

Description

@jeffstjean

The Target Detection class should search for more colours than just red. This should also be configurable and passed in via constructor and/or a method as a numpy array.

Since each mask requires an upper and lower bound, we should consider creating a separate dataclass for storing this information. A simplified version of this is given below. We might want the class to do some validation that the list has a length of exactly 3 (for RGB).

@dataclass
class ColourRange:
    lower: list(np.array)
    upper: list(np.array)

Then the creation of the TargetDetect class might be modified to work like this:

red = ColourRange([0,50,50], [10,255,255])
other_colour = ColourRange([35,50,50], [55,255,255])
detect = TargetDetect([red, other_colour])

The idea is that the TargetDetect class shouldn't care which colours it's detecting but only that it needs to detect some list of colours. This let's the "caller" of the function (the main script) choose which colours for it to detect. This will make future configuration a lot easier.

The TargetDetect class will also need to be modified to include n masks into one mask before masking the image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions