Skip to content

Instantly share code, notes, and snippets.

View johnathanDOS's full-sized avatar
🌵
[ • • ]

Johnathan Ortiz-Sonnen johnathanDOS

🌵
[ • • ]
View GitHub Profile
def prepare_image():
global pngs,image_index,face_cascade
#url_path = "http://"+robot_ip+"/api/alpha/camera?Base64=false"
url_path = "http://"+robot_ip+"/api/alpha/image?FileName=Intruder.jpg&Base64=false"
image = io.imread(url_path)
b,g,r = cv2.split(image)
image = cv2.merge([r,g,b])
image = cv2.resize(image, (0,0), fx=0.5, fy=0.5)
(h, w) = image.shape[:2]
# --------Face Detection--------
misty.TakePicture(false, "Intruder", 1200, 1600, false, true);
misty.SendExternalRequest("POST", "https://dweet.io/dweet/for/misty",null,null,null,"{\"status\":\"Intruder_Alarm_On\"}");
{
"this": "succeeded",
"by": "getting",
"the": "dweets",
"with": [
{
"thing": "misty",
"created": "2019-03-06T06:20:49.288Z",
"content": {
"status": "Intruder_Alarm_On"
url_path = "http://"+robot_ip+"/api/images?FileName=Intruder.jpg&Base64=false"
image = io.imread(url_path)
while True:
try:
time.sleep(1.5)
response = dweepy.get_latest_dweet_for('misty')
new_status = str(response[0]["created"])
print("NOW: ",new_status)
if new_status != old_status:
old_status = new_status
print("Trigger Alarm")
print("Preparing Image")
function _StringMessage(data) {
misty.Set("lastUpdate",(new Date()).toUTCString());
var obj = JSON.parse(data.AdditionalResults[0].Message);
// Misty's heading to the ball
var pan = obj.pan;
// This value is multiplied by -1.0 and passed for the linearVelocity
// to the misty.Drive() command. A larger value for "size" means Misty
#include <Pixy2.h>
// This is the main Pixy object
Pixy2 pixy;
void setup()
{
//Serial.print("Starting...\n");
pixy.init();
OLD = 0;
towards = 0;
Serial.begin(9600);
}
void loop()
{
pixy.ccc.getBlocks();
if (pixy.ccc.numBlocks) {
// ~Max size of the ball in pixels
sizeMin = min(pixy.ccc.blocks[0].m_width, pixy.ccc.blocks[0].m_height);
sizeMax = max(pixy.ccc.blocks[0].m_width, pixy.ccc.blocks[0].m_height);
if (sizeMin >10) {