chameleon | Bring Your Own Solution


Team Updates

Chameleon Eyes
Chameleon Eyes
Carlos Roberto Escobar Soria
# Method to save image, acquired from a web camera connected to a raspberry
# The idea is to save images with motion sensor and take an instant photograph in a forest
def __init__(self):
self.gps = self.getGPS()
self.config = {
.... config firebase
self.firebase = self.connect()
self.db = self.firebase.database()
self.db.child("list-img") =
self.pi = PiCamera()
self.dispatcher = EventDispatcher()
self.directoryToSave = os.path.join(self.getSaveDir(), 'images')
def saveImage(self):
gen = self.getSerialName()
serial_name = "%s_%s" % (gen[0], gen[1])
file_name = '%s_%f_%f.jpg' % (serial_name, self.gps[0], self.gps[1])
path_to_firebase = 'images/%s' % file_name
path_to_local = os.path.join(self.directoryToSave, file_name)
data = {"filename": path_to_firebase,
"date": gen[0],
"time": gen[2],
"latitude": self.gps[0],
"longitude": self.gps[1]
r ="images/%s.jpg" % path_to_firebase).put(path_to_local)
print r
results = self.db.child().push(data)
print "Console: %s to firebase" % results
except ValueError:
print "Console: Firebase offline..."
view raw gistfile1.txt hosted with ❤ by GitHub
# This code is responsible for reading the image and save it in another location and then be synchronized with the database in the cloud
import cv2
class PiCamera():
def __init__(self):
self.cap = cv2.VideoCapture(0)
self.img = (False, None)
def readImage(self):
def exportImage(self, name="/home/pi/instant.jpg"):
self.img = self.readImage()
if self.img[0] is not False:
cv2.imwrite(name, self.img[1], [cv2.IMWRITE_JPEG_QUALITY, 90])
print "Console: Save %s" % (name)
print "Console: Error: no img is saved" % (name)
view raw gistfile2.txt hosted with ❤ by GitHub
# Highlight moving objects, the idea is to process in a server the detection of animals using K-Means (in progress)
while (1):
_, frame2 =
frame1 = cv2.resize(frame1, (400, 300))
frame2 = cv2.resize(frame2, (400, 300))
res1, frame = procesar(frame1, frame2)
mat_puntos = map_out(res1, frame)
res = get_submats(mat_puntos, frame2, frame2)
cv2.imshow("fondo", res1)
cv2.imshow("original", frame2)
frame1 = frame2
i += 1
k = cv2.waitKey(30) & 0xFF
if k == 27:
view raw gistfile3.txt hosted with ❤ by GitHub
Jorge Rolando Encinas

SpaceApps is a NASA incubator innovation program.