diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc0d8ca..b98035c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install apt packages + run: sudo apt update && sudo apt-get install -y libgl1-mesa-glx - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/brickmos/brickify.py b/brickmos/brickify.py index 5bd2537..d09ef02 100644 --- a/brickmos/brickify.py +++ b/brickmos/brickify.py @@ -166,10 +166,12 @@ def closest_color(rgb: tuple[int, int, int], color_range: list) -> BrickColor: """ # Get rgb values of color while adhering to cv2 BGR representation r, g, b = rgb + r, g, b = float(r), float(g), float(b) # Assess euclidean distance of color to all brick colors given color_diffs = [] for color in color_range: cr, cg, cb = color.rgb + cr, cg, cb = float(cr), float(cg), float(cb) color_diff = math.sqrt(abs(r - cr) ** 2 + abs(g - cg) ** 2 + abs(b - cb) ** 2) color_diffs.append((color_diff, color)) # Get color closest to the given one and update its stats