Skip to content

Instantly share code, notes, and snippets.

@tendstofortytwo
Last active December 14, 2017 08:02
Show Gist options
  • Save tendstofortytwo/0d3888bad9ff119f6886f2d338cc4904 to your computer and use it in GitHub Desktop.
Save tendstofortytwo/0d3888bad9ff119f6886f2d338cc4904 to your computer and use it in GitHub Desktop.
Origami-lib getImageArray file path 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():
# accept paths of two images
all_image_paths = origami.getImageArray()
# paths can be accessed as elements of array
image_1_path = all_image_paths[0]
image_2_path = all_image_paths[1]
# load images from path as numpy arrays
image_1 = cv2.imread(image_1_path)
image_2 = cv2.imread(image_2_path)
# need to return something
origami.sendImageArray(all_image_paths, mode='file_path')
return 'OK'
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment