{"id":17114179,"url":"https://github.com/horihiro/azure-functions-python-opencv-example","last_synced_at":"2025-04-13T04:07:10.369Z","repository":{"id":114294975,"uuid":"214170655","full_name":"horihiro/azure-functions-python-opencv-example","owner":"horihiro","description":"Example for using OpenCV in Python 🐍 on Azure Functions \u003c⚡\u003e consumption plan","archived":false,"fork":false,"pushed_at":"2019-11-04T22:50:31.000Z","size":96,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T04:07:06.973Z","etag":null,"topics":["azure-functions","opencv","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/horihiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-10-10T11:57:00.000Z","updated_at":"2021-12-09T09:07:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a946136-f633-42b1-90b2-5e8ddd29a9e9","html_url":"https://github.com/horihiro/azure-functions-python-opencv-example","commit_stats":{"total_commits":28,"total_committers":1,"mean_commits":28.0,"dds":0.0,"last_synced_commit":"5e96d1a25e8cdbad0c78fc559bf9e3157881d9cb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fazure-functions-python-opencv-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fazure-functions-python-opencv-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fazure-functions-python-opencv-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fazure-functions-python-opencv-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/horihiro","download_url":"https://codeload.github.com/horihiro/azure-functions-python-opencv-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661705,"owners_count":21141450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["azure-functions","opencv","python"],"created_at":"2024-10-14T17:15:40.619Z","updated_at":"2025-04-13T04:07:10.362Z","avatar_url":"https://github.com/horihiro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# azure-functions-python-opencv-example\nThis is **unofficial** sample project of Azure Functions for python with OpenCV\n\n  1. Install and run docker daemon\n  1. Clone this repository and open this by VScode with Azure Functions extension.\n  1. Edit `HttpTrigger/__init__.py` if you want\n  1. Deploy to your Function App (Linux and Consumption plan) using Azure Functions extensions.\u003cbr\u003e\n     \u003cimg src=\"./DEPLOY_TO_AZURE1.png\" width=\"300px\"\u003e\u003cbr\u003e\n     or\u003cbr\u003e\n     \u003cimg src=\"./DEPLOY_TO_AZURE2.png\" width=\"300px\"\u003e\u003cbr\u003e\n     This step includes the process which downloads the libraies to `./lib` (see [this](./utils/)) \u003cbr\u003e\n     \u003cbr\u003e\n     **Note:**\u003cbr\u003e\n     If you want to deploy it with `--build-native` option, please try to execute `functions-core-tools` directly after executing `./utils/retrieve_so.sh` or `.\\utils\\retrieve_so.bat`.\n  1. Before merging this [PR](https://github.com/Azure/azure-functions-docker/pull/170) and publishing the container image,\u003cbr\u003e\n     confirm your code if the libraries are loaded before importing like the following.\u003cbr\u003e\n\n     ```py\n     # In order to use `import cv2`, necessary libraries need to be loaded by following code  before the importing.\n     import ctypes\n     exlibpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/lib/'\n     # exlibpath = '/home/site/wwwroot/lib/'\n     ctypes.CDLL(exlibpath + 'libglib-2.0.so.0')\n     ctypes.CDLL(exlibpath + 'libgthread-2.0.so.0')\n\n     import cv2\n     ```\n\n     After merging the PR, you will not need above code, just setting the path including the SO libraries (i.e. `/home/site/wwwroot/lib` ) to App Setting `LD_LIBRARY_PATH`.\u003cbr\u003e\n     ![](./LD_LIBRARY_PATH.png)\n\nThe http trigger function can comvert image, which is specified by `image_url` query parameter, to grayscale image using `cv2.imread`, `cv2.cvtColor` and `cv2.imwrite`\n\n|Input|Output|\n| - | -|\n|![](https://user-images.githubusercontent.com/4566555/66614178-ed7d1c80-ec02-11e9-8b22-4560309db118.png)|![](https://user-images.githubusercontent.com/4566555/66614160-dccca680-ec02-11e9-8946-4db70d5d861a.png)|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorihiro%2Fazure-functions-python-opencv-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhorihiro%2Fazure-functions-python-opencv-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorihiro%2Fazure-functions-python-opencv-example/lists"}