{"id":32156295,"url":"https://github.com/mleseach/templatematching.jl","last_synced_at":"2026-02-19T02:02:24.911Z","repository":{"id":220855499,"uuid":"752185688","full_name":"mleseach/TemplateMatching.jl","owner":"mleseach","description":"A Julia implementation of template matching methods.","archived":false,"fork":false,"pushed_at":"2025-08-18T13:27:29.000Z","size":3497,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-10T02:36:00.839Z","etag":null,"topics":["image-processing","julia","template-matching"],"latest_commit_sha":null,"homepage":"https://mleseach.github.io/TemplateMatching.jl/","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mleseach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-03T09:30:36.000Z","updated_at":"2025-06-26T16:37:42.000Z","dependencies_parsed_at":"2024-05-07T10:39:29.844Z","dependency_job_id":"1b3788b0-b092-4297-b222-b39717678afc","html_url":"https://github.com/mleseach/TemplateMatching.jl","commit_stats":null,"previous_names":["mleseach/templatematching.jl"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mleseach/TemplateMatching.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mleseach%2FTemplateMatching.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mleseach%2FTemplateMatching.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mleseach%2FTemplateMatching.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mleseach%2FTemplateMatching.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mleseach","download_url":"https://codeload.github.com/mleseach/TemplateMatching.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mleseach%2FTemplateMatching.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29600847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T00:59:38.239Z","status":"online","status_checked_at":"2026-02-19T02:00:07.702Z","response_time":117,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-processing","julia","template-matching"],"created_at":"2025-10-21T12:27:42.720Z","updated_at":"2026-02-19T02:02:24.906Z","avatar_url":"https://github.com/mleseach.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TemplateMatching\n\n[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://mleseach.github.io/TemplateMatching.jl/stable/)\n[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://mleseach.github.io/TemplateMatching.jl/dev/)\n[![Build Status](https://github.com/mleseach/TemplateMatching.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/mleseach/TemplateMatching.jl/actions/workflows/CI.yml?query=branch%3Amaster)\n\nTemplateMatching is a Julia package designed to offer a native Julia implementation of\ntemplate matching functionalities similar to those available in OpenCV. This package aims\nto provide an easy-to-use interface for image processing and computer vision applications,\nallowing users to leverage the high-performance capabilities of Julia for template matching\noperations. The package offers performance slightly below that of OpenCV but significantly\nbetter than a naive implementation.\n\n## Documentation\n\nFull documentation and description can be found [here](https://mleseach.github.io/TemplateMatching.jl/stable/)\n\n## Installation\n\nTo install TemplateMatching, use the Julia package manager.\nOpen your Julia command-line interface and run:\n\n```julia\nusing Pkg\nPkg.add(\"TemplateMatching\")\n```\n\n## Features\n\nMasks are not yet supported in the current version of the package.\nUnlike OpenCV, TemplateMatching.jl supports n-dimensional arrays[^1].\n\nBelow is a table summarising available methods and their equivalent in opencv.\n\n| TemplateMatching.jl             | Mask                | OpenCV equivalent      | \n|:--------------------------------|:-------------------:|:-----------------------|\n| `SquareDiff`                    | Not yet supported   | `TM_SQDIFF`            |\n| `NormalizedSquareDiff`          | Not yet supported   | `TM_SQDIFF_NORMED`     |\n| `CrossCorrelation`              | Not yet supported   | `TM_CCORR`             |\n| `NormalizedCrossCorrelation`    | Not yet supported   | `TM_CCORR_NORMED`      |\n| `CorrelationCoeff`              | Not yet supported   | `TM_CCOEFF`            |\n| `NormalizedCorrelationCoeff`    | Not yet supported   | `TM_CCOEFF_NORMED`     |\n\n[^1]: Up to 64 dimensions because of an implementation detail, but this shouldn't be a\nproblem in most cases.\n\n\n## Short demo\n\nFull demo can be found [here](https://mleseach.github.io/TemplateMatching.jl/stable/demos/demos/demo.html)\n\nImport necessary packages\n\n````julia\nusing ImageCore          # Provides core functionalities for image processing\nusing ImageDraw          # Provides drawing functionalities for images\nusing TestImages         # Supplies a collection of test images for experimentation\n\nusing TemplateMatching\n````\n\nLoad the mandrill test image.\n\n````julia\nimg = testimage(\"mandrill\")\n````\n![](assets/demo-4.png)\n\nExtract a specific portion of the image to use as the template.\n\n````julia\ntemplate = img[50:80, 150:200]\n````\n![](assets/demo-6.png)\n\nConvert the image and template to arrays of Float32 type, then perform template matching using Normalized Square Difference as the metric.\n\n````julia\nimg_array = channelview(img) .|\u003e Float32\ntemplate_array = channelview(template) .|\u003e Float32\n\nresult = match_template(img_array, template_array, NormalizedSquareDiff())\nresult = dropdims(result, dims = 1)\n````\n\nDisplay the grayscale version of the result; darker areas indicate closer matches.\n\n````julia\nresult .|\u003e Gray\n````\n![](assets/demo-14.png)\n\nIdentify the location of the best match (the smallest value in the case of Normalized Square Difference), then draw a rectangle around on the original image.\n\n````julia\nloc = argmin(result)\ndraw(\n    img,\n    RectanglePoints(loc[2], loc[1], loc[2] + size(template, 2), loc[1] + size(template, 1)),\n    RGB(1, 0, 0)\n)\n````\n![](assets/demo-18.png)\n\n## License\n\nTemplateMatching is provided under the [MIT License](LICENSE). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmleseach%2Ftemplatematching.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmleseach%2Ftemplatematching.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmleseach%2Ftemplatematching.jl/lists"}