import numpy as np
# Here is code for Interface setup
paintWindow = np.zeros((471,636,3)) + 255
paintWindow = cv2.rectangle(paintWindow, (40,1), (140,65), (0,0,0), 2)
paintWindow = cv2.rectangle(paintWindow, (160,1), (255,65), colors[0], -1)
paintWindow = cv2.rectangle(paintWindow, (275,1), (370,65), colors[1], -1)
paintWindow = cv2.rectangle(paintWindow, (390,1), (485,65), colors[2], -1)
paintWindow = cv2.rectangle(paintWindow, (505,1), (600,65), colors[3], -1)
cv2.putText(paintWindow, "CLEAR", (49, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2, cv2.LINE_AA)
cv2.putText(paintWindow, "BLUE", (185, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(paintWindow, "GREEN", (298, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(paintWindow, "RED", (420, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(paintWindow, "YELLOW", (520, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (150,150,150), 2, cv2.LINE_AA)
cv2.namedWindow('Paint', cv2.WINDOW_AUTOSIZE)
Computer vision Navigation interface
This code creates an interface with the following structure:
- A 470x636 canvas
- Three 255x65 rectangles covering the canvas
- A Clear text area
- Blue text area
- Green text area
- Red text area
- Yellow text area
The code first creates a Paint window, which is a named window that will be used to display the interface. The window is then set to autosize, so it will automatically resize to the size of the canvas.
The first line of code creates a new array called paintWindow. This array will be filled with the colors that will be used in the interface. The colors are stored as a three-dimensional array, and the first dimension is the color's Hue, the second is the saturation, and the third is the brightness. The code creates three 255x65 rectangle objects, and sets the colors of each one to the values stored in paintWindow.
The next line of code creates a rectangle object called paintWindow. This object will be used to display the content of the text areas. The rectangle is set to have a width of 40 pixels, a height of 1 pixel, a position of (40, 1), a position of (140, 65),
Shortcut: interface-struct
0 Comments
Log in to add a comment