-
Notifications
You must be signed in to change notification settings - Fork 109
Demo Script
Deshraj Yadav edited this page Mar 6, 2017
·
1 revision
The objective is to convert a RGB Image to Grayscale using the cvfy library and create a demo out of that.
Please make sure you refer to the CVFY Documentation to learn what a particular method is doing.
import cv2
import cvfy
app = cvfy.register('gh:127.0.0.1:62213840:3000:8004')
@cvfy.crossdomain
@app.listen()
def grayscale():
all_image_paths = cvfy.getImageArray()
image_1_path = all_image_paths[0]
cvfy.sendTextArrayToTerminal(['Loading Image...'])
image_1 = cv2.imread(image_1_path)
cvfy.sendTextArrayToTerminal(['Image Loaded successfully']);
gray_image_1 = cv2.cvtColor(image_1, cv2.COLOR_BGR2GRAY)
cvfy.sendTextArrayToTerminal(['Converting RGB Image to Grayscale']);
cvfy.sendImageArray([gray_image_1], mode = 'numpy_array')
cvfy.sendTextArrayToTerminal([
'Operation completed successfully',
image_1_path
]);
return 'OK'
app.run()