Code Maintenance & Programming Rules

 This guide outlines essential best practices spanning code style, architectural design, debugging, testing, performance, and portability—all aimed at reducing the long-term cognitive load of code maintenance. 🎨 1. Style Code is written for humans to read, and only incidentally for computers to execute. Variable Naming : Use descriptive names for global variables, and short names for local variables. Precision and Consistency : Use active names for functions (e.g., calculateTotal ). Above all, keep your coding style consistent throughout the project. Structure & Expressions : Use a consistent indentation and brace ( {} ) style to show program structure visually. Use the natural form for expressions. Use parentheses to make the semantics unambiguous. Break up overly complex expressions to keep them clear. Side Effects & Macros : Beware of functions with side effects. Avoid function-like macros; if unavoidable, parenthesize the macro body and arguments carefully. Magic Numbe...

OpenCV-Python on Windows with Anaconda 3

OpenCV is a open source computer vision library for real-time applications. It supports many programming languages such as C++, C, Python and Java. In this tutorial, OpenCV is installed with Anaconda 3 running on Windows 10. OK, let's get started.
OpenCV 是一套開發電腦視覺即時處理的函式庫,支援多種程式語言,例如C++、C、Python、Java,本文會在Windows 10上安裝OpenCV與Anaconda 3,我們開始吧!

1. Anaconda 3 安裝 (Anaconda 3 Installation)

Go to https://www.anaconda.com/download/ and download Anaconda 3. Then install it with default settings.
至 https://www.anaconda.com/download/ 下載 Anaconda 3,使用預設設定來安裝。



2. 使用 Anaconda Prompt (Using Anaconda Prompt)


Open the Anaconda Prompt in Anaconda 3 application folder. And test it with the command:
開啟應用程式Anaconda中的Prompt,輸入下面指令:

1
conda --version

The conda version will display on the prompt windows:
conda的版本資訊會顯示在 prompt 視窗中:


3. 建立Python環境 (Create an Python Environment)

Enter the following commands in the prompt windows:
在prompt視窗中輸入下面指令:

1
2
conda create --name userNameCV python=3.6
activate userNameCV

The "userNamceCV" could be any name you like.
"userNamceCV" 可以任意命名。



Checking the Python version:
檢查 Python 版本:
1
python--version




4. 安裝 OpenCV 3 與相依套件 (Install OpenCV 3 and Dependencies)

Enter the following commands in the prompt windows:
在prompt視窗中輸入下面指令:
1
2
3
conda install numpy
conda install anaconda-client
conda install -c conda-forge opencv






Now, checking OpenCV 3 is installed.
檢查Python版本:
python
>>> import cv2
>>> cv.__version__


Congratulation!!! Now, you can use Python and OpenCV3.
恭喜,現在你可以用Python來執行OpenCV3了。

References:
[1] https://github.com/conda-forge/opencv-feedstock/blob/master/README.md
[2] https://chrisconlan.com/installing-python-opencv-3-windows/

若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。

If you like this post, please click the ads on the blog or buy me a coffee. Thank you very much.

留言

這個網誌中的熱門文章