3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry PiAdvent Calendar 2018

Day 13

raspberry pi でwebcam

Last updated at Posted at 2018-07-13

#概要
raspberry pi でwebcamやってみた。

#環境
raspberry pi 1 b
raspbian jessie 8.0
elecom ucam-dlk130

#仕掛け
jsdoのjavascriptでsettimeoutで10秒間隔でimgを読み取る。
node-redの、Execでpythonを動かして、jpegを読み取って送る。
pythonは、opencvで、カメラをキャプチャする。

#jsdo

function tick() {
    img = document.getElementById('koko');
    var now = new Date(); 
    img.src = "http://192.168.11.8:1880/test?" + now.getTime(); 
    setTimeout("tick()", 10000);
}
tick();

#node-red

headerで、contents-typeをセットする。

node.jpg

#python

import cv2

cap = cv2.VideoCapture(0)
ret, frame = cap.read()
cv2.imwrite('test.jpg', frame)
cap.release()
print open("test.jpg", "rb").read()

以上。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?