Feature #448 » mainDisplay_v0.1.py
1 |
# Vaibhav Gupta - Made the skeleton python code for displaying the main image with the projector
|
---|---|
2 |
|
3 |
# ˅˅˅˅˅
|
4 |
from calculate_display_image import CalculateDisplayImage |
5 |
from configure_reader import ConfigureReader |
6 |
import numpy as np |
7 |
import cv2 |
8 |
|
9 |
cR = ConfigureReader() |
10 |
iC = CalculateDisplayImage() |
11 |
|
12 |
class MainDisplay(object): |
13 |
def __init__(self): |
14 |
pass
|
15 |
|
16 |
def displayImage(): |
17 |
gamma = float(cR.getGamma()) |
18 |
image = iC.alphaBlending(gamma) |
19 |
frame = 0 |
20 |
|
21 |
while 1: |
22 |
frame += 1 |
23 |
|
24 |
imagetxt = image.copy() |
25 |
imagetxt = cv2.putText(imagetxt, "Current Gamma Value: " + #... |
26 |
cv2.imshow("", imagetxt) |
27 |
|
28 |
key = cv2.waitKey(1) |
29 |
if key == 27: |
30 |
break
|
31 |
elif key == ord('w'): |
32 |
gamma = += 0.1 |
33 |
image = iC.alphaBlending(gamma) |
34 |
elif key == ord('s'): |
35 |
if gamma - 0.1 > 0: |
36 |
gamma -= 0.1 |
37 |
image = iC.alphaBlending(gamma) |
38 |
elif key == ord('a'): |
39 |
gamma += 0.01 |
40 |
image = iC.alphaBlending(gamma) |
41 |
key == ord('d'): |
42 |
if gamma - 0.01 > 0: |
43 |
gamma -= 0.01 |
44 |
image = iC.alphaBlending(gamma) |
45 |
|
46 |
cv2.destroyAllWindows() |
47 |
|
48 |
displayImage() |