The Following User Says Thank You to sinal For This Useful Post: | ||
![]() |
2011-10-29
, 12:02
|
Posts: 1,101 |
Thanked: 1,185 times |
Joined on Aug 2008
@ Spain
|
#2
|
I wrote a simple program for Maemo by Python to check some pixels color every time that my function is called.
But this program is working so slow (3-5 seconds each call).
Is there any faster way for doing this?
Code:import Image import os import sys #sen_pos = (pixel_x,pixel_y) def sen(sen_pos): os.system("gst-launch v4l2src device=/dev/video0 num-buffers=1 ! ffmpegcolorspace ! jpegenc ! filesink location=cam.jpg") frame = Image.open("cam.jpg") col = frame.getpixel((sen_pos[0],sen_pos[1])) avecol = sum(col)/len(col) if avecol>127: return "white" elif avecol<127: return "black" return None
The Following User Says Thank You to maacruz For This Useful Post: | ||
But this program is working so slow (3-5 seconds each call).
Is there any faster way for doing this?