or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/imutils@0.5.x
tile.json

tessl/pypi-imutils

tessl install tessl/pypi-imutils@0.5.0

A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, displaying Matplotlib images, sorting contours, detecting edges, and much more easier with OpenCV and both Python 2.7 and Python 3.

Agent Success

Agent success rate when using this tile

91%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.34x

Baseline

Agent success rate without this tile

68%

task.mdevals/scenario-8/

Image Visualization Tool

Build a tool that loads images using OpenCV and displays them using Matplotlib for visualization. The tool should handle proper color format conversion to ensure images appear correctly in Matplotlib plots.

Requirements

Create a Python module that provides functionality to:

  1. Load an image from a file path using OpenCV
  2. Convert the loaded image to the appropriate color format for Matplotlib display
  3. Display the image using Matplotlib with a configurable title
  4. Support grayscale images (display them without color conversion)

The solution should handle both color and grayscale images correctly.

Implementation

@generates

API

def visualize_image(image_path, title="Image"):
    """
    Load an image from the given path and display it using Matplotlib.

    Args:
        image_path (str): Path to the image file
        title (str): Title to display above the image (default: "Image")

    Returns:
        None

    Raises:
        FileNotFoundError: If the image file does not exist
    """
    pass

Test Cases

  • Loads a color image (BGR format) from a file and displays it correctly in Matplotlib with proper RGB colors @test
  • Loads a grayscale image and displays it correctly in grayscale @test
  • Raises FileNotFoundError when the image file does not exist @test

Dependencies { .dependencies }

imutils { .dependency }

Provides convenience functions for image processing operations.

opencv-python { .dependency }

Provides computer vision and image processing capabilities.

matplotlib { .dependency }

Provides plotting and visualization support.