Have you ever used OpenCV in your projects? probably yes if you are on this page
And what about Azure Functions?
if the answer is true to both then what about creating a Python Azure Function
with OpenCV module?
Lest try it out.
The main problem with Azure Function is that in Python it supports only version 3.6
and not 3.7. I’m using the latest version and got into a problem where I compiled the code it got me errors that the version is not supported, too bad but we can override this.
let’s start from step 1 and it’s creating your Azure Function project and the steps are:
Install Python 3.6 version, if you have another version it’s not a problem but don’t add the path to the main directory when installing.
- Install Azure Function Tools with NPM
npm install -g azure-functions-core-tools
if you don’t have NPM to go NPM Install site
2. Install Azure CLI from Microsoft
3. Next is the most important part and its the support of version 3.6 even if you have a default other versions
run this command in your CMD and don’t close it
py -3.6 -m venv .venv
now 3.6 is your version in the CMD
4. install OpenCV and Numpy
pip install opencv-python nupy
5. craete your Azure Function project and select Python
func init OpenCVFunction