讀取 IP Cameras 的方法非常簡單
可以直接使用 Open CV package
import cv2
# ip camera 的擷取路徑
URL = "rtsp://admin:admin@192.168.1.1/1"
# 建立 VideoCapture 物件
ipcam = cv2.VideoCapture(URL)
# 使用無窮迴圈擷取影像,直到按下Esc鍵結束
while True:
# 使用 read 方法取回影像
stat, I = ipcam.read()
2019年5月12日 星期日
python 有關 SQL Lite multi-thread
最近會用到 SQL Lite multi-thread , 主要是用在 TCP server 端
server 會同時收到很多的連線, 這是就要用 multi-thread 來處理了
下面是別人寫的SQL Lite multi-thread
這面先做紀錄
https://scar.tw/article/2012/09/12/sqlite3-multi-thread-in-python/
server 會同時收到很多的連線, 這是就要用 multi-thread 來處理了
下面是別人寫的SQL Lite multi-thread
這面先做紀錄
https://scar.tw/article/2012/09/12/sqlite3-multi-thread-in-python/
2019年5月10日 星期五
python TCP 心得
今天遇到一個 tcp 問題 , 有時 server 端會同時收到 client 送來的兩筆之料
檢查了 code 沒有發現問題 卡關了很久
google 才知道 是 TCP 的問題 , 如果資料都是小封包, 且連續傳送 TCP 會主動將兩封包合併傳輸, 以增加網路效率
解法 有兩個 1 是 delay 0.4 sec 以上, 我有試過 0.1 還是有機會發生這狀況
另一個 是 改用 UDP
下面是別人的回覆
https://stackoverflow.com/questions/39931611/python-socket-recv-doesnt-get-every-message-if-send-too-fast
細節可以查
檢查了 code 沒有發現問題 卡關了很久
google 才知道 是 TCP 的問題 , 如果資料都是小封包, 且連續傳送 TCP 會主動將兩封包合併傳輸, 以增加網路效率
解法 有兩個 1 是 delay 0.4 sec 以上, 我有試過 0.1 還是有機會發生這狀況
另一個 是 改用 UDP
下面是別人的回覆
https://stackoverflow.com/questions/39931611/python-socket-recv-doesnt-get-every-message-if-send-too-fast
細節可以查
Nagle's algorithm
訂閱:
文章 (Atom)
Ether.FI 神卡 https://www.ether.fi/@46933474
Ether.FI 真的是神卡 有買US Amazon 或穩定幣的很適合辦一張 我的推薦碼 https://www.ether.fi/@46933474
-
最近常需要更新 embeded 產品的 bootcode 會需要用到 TFTP server . 再 Windows 上可以直接下載免費的 TFTP server 軟體 , 但 MacBook Pro 找不到好用的 不過 MacBook Pro 有自帶 TFTP server ...
-
按鈕(Buttons) 是 GUI 中很常用到的元件 按鈕的建置跟上一篇提到很相識, 但多了一個連動的概念以 PyQT 來說就是Signals and Slot (訊號與槽) 葉就是說當我按了一個 Button ( 發射一個訊號) 要執行哪個動作 (到哪個槽) ...
-
python memory issues blogs http://terrence.logdown.com/posts/700111-python-track-memory-usage https://www.codetw.com/ceplqhk.html http...
