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 in Windows 在Windows上使用OpenCV-Python

筆者嘗試在自己的筆電上裝OpenCV-Python,參考的文章為:Install OpenCV-Python in Windows。需要下載三個軟體套件:

  1. Python-2.7.x
  2. Numpy
  3. Matplotlib (選擇性的套件,建議安裝,因為OpenCV的教學文章常用到)


使用預設選項安裝此三個套件,而Python會安裝在C:\Python27\

安裝完後請開啟 Python IDLE,輸入 import numpy檢查Numpy是否可正常使用。


從 sourceforge site下載最新版的 OpenCV,並解壓縮。

opencv/build/python/2.7/x86/ cv2.pyd 複製到 C:/Python27/lib/site-packages


請開啟 Python IDLE,輸入 import cv2print( cv2.__version__ ) 指令,若有輸出 OpenCV 的版本,就是安裝成功了。

接下來就可以使用 OpenCV 與 Python 來做 Computer Vision 相關的應用了。

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

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

留言

這個網誌中的熱門文章