Skip to content

Instantly share code, notes, and snippets.

@tendstofortytwo
Last active December 14, 2017 08:14
Show Gist options
  • Save tendstofortytwo/887d50defd21dabf85cc02bdd80211c6 to your computer and use it in GitHub Desktop.
Save tendstofortytwo/887d50defd21dabf85cc02bdd80211c6 to your computer and use it in GitHub Desktop.
Origami-lib getImageArray Numpy Array example
import cv2
import origami
# all memory/processor intensive work that is to be done only once (like loading models) goes here
# replace $TOKEN with your app token generated by web app
app = origami.register('$TOKEN')
@origami.crossdomain
@app.listen()
def images():
# mode option lets you get numpy arrays directly
all_images = origami.getImageArray(mode='numpy_array')
# load images from array
image_1 = all_images[0]
image_2 = all_images[1]
# you can check that each image is a numpy array
print type(image_1)
# need to return something
origami.sendImageArray(all_images, mode='numpy_array')
return 'OK'
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment