Exemple #1
0
    def __init__(self):
        self.image_sub = rospy.Subscriber("/xtion/rgb/image_raw", Image, self.image_callback)
        self.label_sub = rospy.Subscriber("/hearts/obj_rec/label", String, self.label_callback)
        self.camera_info_sub = rospy.Subscriber("/camera_info", CameraInfo, self.camera_info_callback)

        self.listener = TransformListener()
                
        self.reference_frame = rospy.get_param("reference_frame", "")
        
        if not self.listemer.frameExists(self.reference_frame):
            rospy.logerr("invalid reference frame: " + self.reference_frame)
            
        self.camera_frame = rospy.get_param("camera_frame", "")

        if not self.listemer.frameExists(self.camera_frame):
            rospy.logerr("invalid camera frame: " + self.camera_frame)
            
        self.temp_file_path = "/tmp/obj_rec_1/"
        
        self.bridge = CvBridge()
        self.match = re.compile("name': u'(.*?)',")

        self.h_margin = 100;
        self.v_margin = 100;
        
        self.n_attempts = 1
        self.n_h_regions = 4
        self.n_v_regions = 3
    
        cv2.namedWindow("image", cv2.WINDOW_NORMAL)
	    
        self.auth = cloudsight.OAuth('t-xw3Mn06dkObZwsi8qpcA', 'laJ83zYRxAVpls1Aera8Mg')
        self.api = cloudsight.API(self.auth)
        
        self.image_regions = None
    def __init__(self):
        rospy.Subscriber('/camera/rgb/image_raw/crop', String,
                         self.CropImageFileCallback)

        self.pubGoal = rospy.Publisher('/hearts/or/item', String, queue_size=1)
        self.pubStatus = rospy.Publisher('/hearts/cloudsight/status',
                                         String,
                                         queue_size=1)

        self.auth = cloudsight.OAuth('t-xw3Mn06dkObZwsi8qpcA',
                                     'laJ83zYRxAVpls1Aera8Mg')
        self.api = cloudsight.API(self.auth)

        self.image_attempts = 0
        self.max_attempts = 2
Exemple #3
0
import cloudsight
from flask import Flask
import os
import sys

# INIT
#api_key = "q1RmugXxnjuAa_4mBSW93w"
#secret = "M8z18rMeiyenNIntIevW1Q"
api_key = "8ZyGYkpmEVK1wJDb5uiBog"
secret = "tx25bk7L_J-DqLPCkDBrOg"
#auth = cloudsight.SimpleAuth(api_key)
auth = cloudsight.OAuth(api_key, secret)
api = cloudsight.API(auth)

with open('test_image.jpg', 'rb') as f:
    response = api.image_request(f, 'your-file.jpg', {
        'image_request[locale]': 'en-US',
    })

status = api.wait(response['token'], timeout=30)


import urllib.request
import  urllib.parse
import  cloudsight

auth = cloudsight.OAuth("nSmkfLGwl4-yW1s-swKoXA", "8u3iemtYYiIcFaZOK1E4QA")
api = cloudsight.API(auth)

with open('0_1.png', 'rb') as f:
    response = api.image_request(f, '0_1.png', {
        'image_request[locale]': 'zh-CN',
        'image_request[language]': 'zh-CN'
    })
print(response)
Exemple #5
0
import cloudsight

auth = cloudsight.SimpleAuth('EUVIyy2Rp_OGH7pm8z9oxA')
api = cloudsight.API(auth)
auth = cloudsight.OAuth('EUVIyy2Rp_OGH7pm8z9oxA', 'xqgUfGKc4SfKUW9CSeZeXw')
api = cloudsight.API(auth)

with open('sun.jpg', 'rb') as f:
    response = api.image_request(f, 'sun.jpg', {
        'image_request[locale]': 'en-US',
    })

'''
response = api.remote_image_request('http://www.example.com/image.jpg', {
    'image_request[locale]': 'en-US',
})
'''

status = api.image_response(response['token'])
if status['status'] != cloudsight.STATUS_NOT_COMPLETED:
    # Done!
    pass
    
status = api.wait(response['token'], timeout=30)
Exemple #6
0
    if not ret:
        break
    k = cv2.waitKey(1)

    if k % 256 == 27:
        # ESC pressed
        print("Escape hit, closing...")
        break
    elif k % 256 == 32:
        # SPACE pressed
        img_name = "opencv_frame_{}.png".format(img_counter)
        cv2.imwrite(img_name, frame)
        print("{} written!".format(img_name))
        img_counter += 1

auth = cloudsight.OAuth('6qj8DDj8TmCfYkl6Ysx5cg',
                        'U2RLYEjRHUZpmrrvtiKMww')  #cloudsight
api = cloudsight.API(auth)

with open('opencv_frame_0.png', 'rb') as f:
    response = api.image_request(f, 'opencv_frame_0.png', {
        'image_request[locale]': 'en-US',
    })

status = api.wait(response['token'], timeout=30)
if status['status'] != cloudsight.STATUS_NOT_COMPLETED:
    #    print status
    pass

statusStr = str(status)  # Converts the status to string
char = 'name'
colan = "',"
Exemple #7
0
#!/usr/bin/python
from time import sleep
from LocalVariables import key
from LocalVariables import secret
import cloudsight

auth = cloudsight.OAuth('%s' % key, '%s' % secret)
api = cloudsight.API(auth)


def UploadPicture():
    with open('image.jpg', 'rb') as f:
        response = api.image_request(f, 'image.jpg', {
            'image_request[locale]': 'en-US',
        })

    status = api.wait(response['token'], timeout=30)
    status = api.image_response(response['token'])
    print(status['status'])
    if status['status'] != cloudsight.STATUS_NOT_COMPLETED:
        print(status['name'])
        global item
        item = status['name']
    else:
        print("Not Completed")
Exemple #8
0
def auth():
    auth = cloudsight.OAuth('ID', 'Key')
    api = cloudsight.API(auth)
    return api