2015年8月11日 星期二

Opencv 繪圖

繪製各種形狀的圖形



# -*- coding: utf-8 -*-
import cv2
import numpy as np

#  畫布大小
img = np.zeros((720,1280,3), np.uint8)
# (位置),大小,(顏色)粗度
cv2.circle(img,(200,200), 100, (0,0,255), 2)
# (第一個座標)(第二個座標)(顏色),粗度
cv2.rectangle(img,(350,100),(550,300),(0,255,0),3)
# (第一個座標)(第二個座標)(顏色),粗度
cv2.line(img,(600,100),(800,300),(255,0,0),10)

pts = np.array([[10,5],[20,30],[70,20],[50,10]], np.int32)
pts = pts.reshape((-1,1,2))
cv2.polylines(img,[pts],True,(0,255,255))

font = cv2.FONT_HERSHEY_SIMPLEX
# (座標),大小,(顏色),粗度
cv2.putText(img,'Charlotte.HonG',(0,500), font, 5,(255,255,255),10,cv2.CV_AA)

while(1):
    cv2.imshow('Dring',img)
    if cv2.waitKey(20) & 0xFF == 27:
        break
cv2.destroyAllWindows()

2015年6月3日 星期三

UART(RX TX) RaspberryPI 與 Arduino 互傳字串

將Arduino與RasveryPi版上的RX與TX互接(PiRX=ArduiTX)
Pi版上請參考該技術手冊,Arduino則由程式碼內可得知



執行:ps ax | fgrep AMA

你會看到
2039 ? Ss+ 0:00 /sbin/getty -L ttyAMA0 115200 vt100
2055 pts/0 S+ 0:00 fgrep --color=auto AMA
確認無誤之後,繼續輸入以下指令:
sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt
將cmdline.txt備份
sudo vim /boot/cmdline.txt

cmdline.txt如下:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
將它改為:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

2015年5月29日 星期五

Raspberry Pi B+ 使用網頁控制LED

編譯python檔在Pi上使用指令控制LED【w=亮;s=滅】

vim led_str_ctrl.py

按i並貼上底下程式碼:
====================================================================
#!/usr/bin/python
import RPi.GPIO as G # reference the GPIO library
G.setmode(G.BCM) # use the 'BCM' numbering scheme for the pins
G.setup(18, G.OUT) # Set pin 18 as an Output
while (True): # keep going around this loop until we're told to quit
key = raw_input("Enter 'w' for On, 's' for Off and any other key to quit. You'll need to press enter after each character: ")
if key == "w":
G.output(18, True) # Turn it on
elif key == "s":
G.output(18, False) # Turn it off
else:
break # leave our loop
G.cleanup() # Tidy up after ourselves so we don't generate warnings next time we run this

2015年5月24日 星期日

ASUS_AR-Z97_ACPI在裝置管理員出現驚嘆號_ACPI\PNP0A0A

ASUS ACPI在裝置管理員出現驚嘆號_ACPI\PNP0A0A

驅動少裝

爬文有發現,AMD00要先安裝否則系統會有驚嘆號

補裝還是有問題

將他右鍵解除裝置,隨後重新開機仍會有驚嘆號
此時滑鼠靈敏度出現一點異常(我的會這樣其他電腦可能不會)
重新安裝AMD00驅動一次
Win7資料夾內與外都用右鍵管理安裝,再重新開機一次就好了。
-
2015/05/24 紀錄本次處理流程,仍未知關鍵性操作。
就這樣做就好了,確定是少裝AMD00,不過有時候裝了還會出現
建議優先安裝AMD00,後來嘗試這樣做好像一次解決了