This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
misty.TakePicture(false, "Intruder", 1200, 1600, false, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
misty.SendExternalRequest("POST", "https://dweet.io/dweet/for/misty",null,null,null,"{\"status\":\"Intruder_Alarm_On\"}"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"this": "succeeded", | |
"by": "getting", | |
"the": "dweets", | |
"with": [ | |
{ | |
"thing": "misty", | |
"created": "2019-03-06T06:20:49.288Z", | |
"content": { | |
"status": "Intruder_Alarm_On" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url_path = "http://"+robot_ip+"/api/images?FileName=Intruder.jpg&Base64=false" | |
image = io.imread(url_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Pixy2.h> | |
// This is the main Pixy object | |
Pixy2 pixy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() | |
{ | |
//Serial.print("Starting...\n"); | |
pixy.init(); | |
OLD = 0; | |
towards = 0; | |
Serial.begin(9600); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |