I'm developing a generic computer vision application in Python. I use dxcam to grab a user's screen, use yolov8 in ultralytics to detect features, and then use opencv to decorate the features detected in the screenshot. I then display a click-through always-on-top opencv window, so it appears to the user in near-real-time. Think something like Snapchat filters.
I am implementing the decoration code as classes that have a consistent interface. For example, one might draw boxes around flowers, one might put a tiara on any heads, one might draw a black box over guns. The user will be presented with a GUI that shows all the available decorators, and then selects which to "turn on".
I want to make it as easy as possible for other people to contribute other decorators. What I am imagining so far is to have a package folder /decorators/. To create a new decorator, a user will simply drop a .py file into that folder - for example, corvusdec003.py. That py file MUST define a class named decorator, which must have functions description (shown to user in GUI), initialize, and decorate_image.
Is this the best solution? I would still need some way to programmatically enumerate all the modules in the package and load the decorator class from each of them. I'm sure there's a way to do that, but this seems strange enough that I want to ask if there's a better way (to do something that admittedly is a weird thing to do, automatically incorporating user-contributed code).