Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion canvas.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,7 @@ def save_drawing(self):
def clear(self):
"""This function clears the screen.
"""
cv2.rectangle(self.new_canvas, (0, 0), (self.width, self.height), (0, 0, 0))
canvas.new_canvas = np.zeros((canvas.height, canvas.width, 3), np.uint8)


if __name__ == "__main__":
Expand Down
12 changes: 8 additions & 4 deletions fingerTrack.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,10 +82,13 @@ def find_center(self, mask, target):
self.path.append((self.cx, self.cy))
else:
self.path = self.shift(self.path, (self.cx, self.cy))
dist2hue = self.map(distance, 0.0, 10.0, 0.0, 255.0)
dist2hue = self.map(distance, 0.0, 150.0, 0.0, 255.0)
paintColor = self.brush_color(dist2hue)
self.colors.append((int(paintColor[0][0][0]), int(paintColor[0][0][1]), int(paintColor[0][0][2])))
print(paintColor, pair)
if len(self.colors) < self.pathlength:
self.colors.append((int(paintColor[0][0][0]), int(paintColor[0][0][1]), int(paintColor[0][0][2])))
else:
self.colors = self.shift(self.colors, (int(paintColor[0][0][0]), int(paintColor[0][0][1]), int(paintColor[0][0][2])))
print(self.colors)
cv2.circle(target, (self.cx, self.cy), 2, (0, 255, 0), -1)
self.notFound = False
except IndexError:
Expand DownExpand Up@@ -113,4 +116,5 @@ def det(p1, p2, p3, p4):
return deltaA * deltaD - deltaB * deltaC
div = det(self.path[-1], self.path[-2], self.path[-3], self.path[-4])
if div != 0 and not self.notFound:
print('the two line intersects!!!')
""""""
# print('the two line intersects!!!')