sudo apt-get update #更新軟體列表 sudo apt-get upgrade #更新軟體包 sudo apt-get install #安裝套件 sudo apt-get remove #移除套件 查看SD卡空間狀況 df -h 設定樹莓派系統參數 sudo raspi-config vcgencmd measure_temp 查看CPU和GPU記憶體 vcgencmd get_mem arm #CPU vcgencmd get_mem gpu #GPU 查看韌體版本 vcgencmd version 執行Python程式 sudo python abc.py sudo apt-get install GIMP sudo apt-get install VLC sudo apt-get install thunderbird dpkg --list #顯示已安裝的軟體 sudo apt-get --purge remove XXX #刪除上面指令清單中的XXX軟體 使用pip安裝Python套件 sudo pip install 安裝Python常用套件 sudo apt-get install zip unzip (壓縮解壓縮) pip3 install ipython (Python Shell) pip3 install requests (網頁擷取) pip3 install beautifulsoup4 (網頁解析) pip3 install selenium (自動化工具) pip3 install django (網頁開發框架) sudo apt-get install sqlite3 (SQLite 資料庫) sudo apt-get install r-base (R 語言) sudo apt-get install nginx (Web 伺服器) sudo pip3 install uWSGI (WSGI 伺服器) pip3 install numpy (科學計算) pip3 install scipy (科學計算) pip3 install matplotlib (2D 繪圖) pip3 install pandas (數據處理) pip3 install scikit-learn (機器學習) 安裝截圖軟體scrot sudo apt-get install scrot 預設抓取的目錄在 /home/pi/ 中 終端機輸入 scrot #抓取整個桌面 scrot -s #滑鼠選取範圍 scrot -u #抓目前視窗 安裝Vim編輯器 sudo apt-get install vim 安裝PIP套件管理 sudo apt-get install python-pip 安裝Node.js curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt install nodejs node -v 玩DOS遊戲 樹莓派 Raspberry Pi 使用 DOSBox 模擬器玩 DOS 經典遊戲 Raspberry Pi模擬DOS玩遊戲 個人雲端系統 Raspberry Pi 筆記(31):建立個人雲端儲存系統 (二) Owncloud 常見的作業系統 影音播放系統 Raspbian 官方推薦的首選系統 Ubuntu Mate Raspberry Pi上的Ubnutu RetroPie 在樹莓派上玩街機遊戲 樹莓派作業系統大全 http://wiki.nxez.com/rpi:list-of-oses sudo apt-get update #更新軟體列表 sudo apt-get upgrade #更新軟體包 sudo apt-get install #安裝套件 sudo apt-get remove #移除套件 查看SD卡空間狀況 df -h 設定樹莓派系統參數 sudo raspi-config vcgencmd measure_temp 查看CPU和GPU記憶體 vcgencmd get_mem arm #CPU vcgencmd get_mem gpu #GPU 查看韌體版本 vcgencmd version 執行Python程式 sudo python abc.py sudo apt-get install GIMP sudo apt-get install VLC sudo apt-get install thunderbird dpkg --list #顯示已安裝的軟體 sudo apt-get --purge remove XXX #刪除上面指令清單中的XXX軟體 使用pip安裝Python套件 sudo pip install 安裝Python常用套件 sudo apt-get install zip unzip (壓縮解壓縮) pip3 install ipython (Python Shell) pip3 install requests (網頁擷取) pip3 install beautifulsoup4 (網頁解析) pip3 install selenium (自動化工具) pip3 install django (網頁開發框架) sudo apt-get install sqlite3 (SQLite 資料庫) sudo apt-get install r-base (R 語言) sudo apt-get install nginx (Web 伺服器) sudo pip3 install uWSGI (WSGI 伺服器) pip3 install numpy (科學計算) pip3 install scipy (科學計算) pip3 install matplotlib (2D 繪圖) pip3 install pandas (數據處理) pip3 install scikit-learn (機器學習) 安裝截圖軟體scrot sudo apt-get install scrot 預設抓取的目錄在 /home/pi/ 中 終端機輸入 scrot #抓取整個桌面 scrot -s #滑鼠選取範圍 scrot -u #抓目前視窗 安裝Vim編輯器 sudo apt-get install vim 安裝PIP套件管理 sudo apt-get install python-pip 安裝Node.js curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt install nodejs node -v 玩DOS遊戲 樹莓派 Raspberry Pi 使用 DOSBox 模擬器玩 DOS 經典遊戲 Raspberry Pi模擬DOS玩遊戲 個人雲端系統 Raspberry Pi 筆記(31):建立個人雲端儲存系統 (二) Owncloud 常見的作業系統 影音播放系統 Raspbian 官方推薦的首選系統 Ubuntu Mate Raspberry Pi上的Ubnutu RetroPie 在樹莓派上玩街機遊戲 樹莓派作業系統大全 http://wiki.nxez.com/rpi:list-of-oses src = cv2.imread("square-1.png") #將圖片檔案讀進來 gray = cv2.imread("square-1.png",cv2.IMREAD_GRAYSCALE) #將圖片檔案讀進來並轉成灰階 print(type(src)) print(len(src)) print(src.shape) (x,y,z)=src.shape print((x,y,z)) for i in range(0,x,4): print(i,50,src[i][50][0],src[i][50][1],src[i][50][2]) 0 50 255 255 255 80 50 232 162 0 4 50 255 255 255 84 50 232 162 0 8 50 255 255 255 88 50 232 162 0 12 50 255 255 255 92 50 232 162 0 16 50 255 255 255 96 50 232 162 0 20 50 255 255 255 100 50 232 162 0 24 50 255 255 255 104 50 232 162 0 28 50 255 255 255 108 50 232 162 0 32 50 0 0 0 112 50 232 162 0 36 50 0 0 0 116 50 232 162 0 40 50 232 162 0 120 50 0 0 0 44 50 232 162 0 124 50 0 0 0 48 50 232 162 0 128 50 255 255 255 52 50 232 162 0 132 50 255 255 255 56 50 232 162 0 136 50 255 255 255 60 50 232 162 0 140 50 255 255 255 64 50 232 162 0 144 50 255 255 255 68 50 232 162 0 148 50 255 255 255 72 50 232 162 0 152 50 255 255 255 76 50 232 162 0 156 50 255 255 255 # Using cv2.COLOR_BGR2GRAY color space 將彩色圖片改成灰階 image = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY ) cv2.imwrite("star_gray.jpg", image) #寫出新的圖片檔案 # cv2.rectangle() method 在圖片裡面畫一個矩形 start_point = (5, 5) end_point = (220, 220) color = (255, 0, 0) # Blue color in BGR thickness = 4 # Line thickness of 4 px image = cv2.rectangle(src, start_point, end_point, color, thickness) image = cv2.rectangle(image, (100,100),(400,400), (0,0,255), thickness) cv2.imwrite("star_rect.jpg", image) # 將兩個圖片水平、垂直並列 import numpy as np a=cv2.imread("star.jpg") b=cv2.imread("star_rect.jpg") c=np.hstack((a,b)) d=np.vstack((a,b)) cv2.imwrite("star_hstack.jpg", c) cv2.imwrite("star_vstack.jpg", d)