Contenido principal

showmatches

R2026b

Visualize shape model matches in search image

Since R2026b

    Description

    showmatches(model,matches,searchImage) visually marks shape model matches in searchImage.

    showmatches(model,matches,searchImage,Name=Value) specifies options using one or more name‑value arguments. For example, DisplayBox=false specifies that rotated bounding boxes are not shown for matches.

    Examples

    collapse all

    Read and display the template image.

    templateImage = imread("edgeMatchModel.png");
    imageshow(templateImage)

    Create a shape model object, then visualize the shape model by using the show function.

    model = shapemodel(templateImage);
    show(model)

    Read and display the search image,

    searchImage = imread("edgeMatchSearch1.png");
    imageshow(searchImage)

    Find and locate shape model instances in the search image by using the matchshape function. Set MaxMatches to 10 to return up to ten instances.

    matches = matchshape(model,searchImage,MaxMatches=10);

    Visualize the shape model matches in the search image by using the showmatches function.

    showmatches(model,matches,searchImage)

    Input Arguments

    collapse all

    Shape model created using a template image, specified as a shapemodel object or an array of shapemodel objects. When you specify an array of shapemodel objects, each element represents a shape model created using a different template image.

    Shape matching results returned by the matchshape function, specified as a 1‑by‑N array of Match objects. Each element corresponds to one detected shape model instance.

    Image data to search for instances of the shape model, specified as one of the following image types:

    • Grayscale image — Specify an m-by-n numeric matrix.

    • RGB image — Specify an m-by-n-by-3 numeric array.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: DisplayClassname=true specifies that class names are shown for matches.

    Marker color, specified as a short color name, color name, or RGB triplet.

    Example: "b" specifies that the markers are blue

    Parent Viewer for the visualization, specified as a Viewer object. Create a Viewer object for 2‑D image display by using the viewer2d function.

    Option to display the rotated bounding box that encloses the detected shape model instance, specified as true or false.

    Option to display shape contour lines of each match, specified as true or false.

    Option to display the class labels of each match, specified as true or false.

    Version History

    Introduced in R2026b

    See Also

    |