Skip to content

[Request] Remove OpenCV requirement from the core for 300MB #582

Open
@m-roberts

Description

@m-roberts

Problem or Possibility

Currently OpenCV is installed with the core of the SDK, but it appears to only be used by ImageFunctions.convert
Removing this dependency from the core would help to reduce install footprint for core functionality.

It is used in pitop.processing and pitop.camera, but - most importantly - it does the heavy lifting of the miniscreen's display_image function.

Proposed Solution

An OpenCV image is unlikely to be passed in without the cv2 dependency being installed, so it shouldn't even be necessary to invoke the convert function anyway.

Perhaps the display_image function could try to convert if the image format is PIL and raises an exception if it's an OpenCV image without the dependency installed?

Alternative Solutions

According to this, this operation should also work:

x = x[...,::-1].copy()

However, this does not have OpenCV's speed benefit. Perhaps this can be used as a fallback option if OpenCV is not available?

Additional Context

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