Canada
Asked — Edited

Getting Ezb Camera Feed Using Opencv And Python

Just an example showing how to get the EZB camera feed using Opencv and python. EZ builder has a greta setup but for those who would like to experiment with image processing for pattern recognition further opencv is a good start.

You have to your camera running in EZB and have the HTTP server on. You get a live video stream with a small delay, nothing like the wireless cameras that some of you may have started with. I also have a line to send $data back to EZB.

There's a learning curve but after seeing what Justin created with his EZface program its worth it. You need to download opencv for windows and python 2.7.

import numpy as np import cv2.cv as cv import time import cv2 import urllib

cv.NamedWindow("camera", 0) cv.ResizeWindow("camera", 640, 480)

Your URL could be different

ezb=("http://192.168.1.2/CameraImage.jpg?c=Camera&Password=admin";) Y=0

while True:

sock=urllib.urlretrieve(ezb)
capture = cv.CaptureFromFile(sock[0])
img = cv.QueryFrame(capture)
cv.ShowImage("camera",img)


#test sending data back to EZB
Y=Y+1    
D=str(Y)
ezb2=("http://192.168.1.2/Exec?password=admin&script=$data="+D)
urllib.urlopen(ezb2)


    
    break

cv.DestroyAllWindows()


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.