Soc ninja title

Orange Pi Zero

Setting up a wireless network:

# nmtui-connect <SSID-name>

Setting a Static IP Address:

# nmtui edit

Monitoring temperature:

# armbianmonitor -m

Reduce temperature:

# h3consumption -m 900 <CPU clock> -c 2 <cores activated>

Capture image:

# fswebcam -r 640x480 --jpeg 85 -D 1 web-cam-shot.jpg

Testing camera:

# v4l2-ctl --list-formats-ext
[...]
Pixel Format: 'MJPG' (compressed)
Name : Motion-JPEG
Size: Discrete 640x480
Interval: Discrete 0.017s (60.000 fps)
[...]
# apt-get install libv4l-dev python-dev
# git clone https://github.com/gebart/python-v4l2capture.git
# cd python-v4l2capture
# ./setup.py build
# ./setup.py install

Download opencv_capture_v4l2.py from:

https://gist.github.com/royshil/0f674c96281b686a9a62

To calcule FPS:

#!/usr/bin/env python
import numpy as np
import cv2
import os
import v4l2capture
import select
import time
if __name__ == '__main__':
video = v4l2capture.Video_device("/dev/video0")
size_x, size_y = video.set_format(640, 480, fourcc='MJPG')
print "device chose {0}x{1} res".format(size_x, size_y)
video.create_buffers(30)
video.queue_all_buffers()
print "start capture"
video.start()
startTime = time.time()
fps = 0
while time.time() <= startTime + 5:
select.select((video,), (), ())
image_data = video.read_and_queue()
frame = cv2.imdecode(np.frombuffer(image_data, dtype=np.uint8), cv2.cv.CV_LOAD_IMAGE_COLOR)
fps+=1
print ("Got FPS: " + str(fps/5))
video.close()
 cv2.destroyAllWindows()



If you found anything useful enough and you want to thank us for that, please consider donating to people who need it, like the NGO OXFAM. Thank you !


Comments

Comments are manually approved. Just be a bit patient :-)

There are currently no comments

New Comment

required

required (not published)

optional

Recent Tweets