WankioM
commited on
Update contourfinder.py
Browse files- OpenCV/contourfinder.py +8 -5
OpenCV/contourfinder.py
CHANGED
@@ -18,7 +18,7 @@ def list_of_positions(num_contours,num_frames=100):
|
|
18 |
|
19 |
|
20 |
|
21 |
-
def contourfinder(image1, image2, text=None):
|
22 |
#Create two blank pages to write into
|
23 |
blank = np.zeros(image1.shape, dtype='uint8')
|
24 |
blank2 = np.zeros(image1.shape, dtype='uint8')
|
@@ -30,7 +30,7 @@ def contourfinder(image1, image2, text=None):
|
|
30 |
|
31 |
threshold2=cv2.Canny(image=original2, threshold1=100, threshold2=200)
|
32 |
contours2, hierarchies2 = cv2.findContours(threshold2, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
|
33 |
-
|
34 |
|
35 |
#Initialize three empty videos
|
36 |
vid1 = cv2.VideoWriter('vid1.mp4',cv2.VideoWriter_fourcc(*'mp4v'), 24, threshold.shape)
|
@@ -52,7 +52,8 @@ def contourfinder(image1, image2, text=None):
|
|
52 |
|
53 |
#Complile to video
|
54 |
vid1.write(blank)
|
55 |
-
|
|
|
56 |
|
57 |
positions=list_of_positions((len(contours2)))
|
58 |
|
@@ -62,7 +63,8 @@ def contourfinder(image1, image2, text=None):
|
|
62 |
frames.append(blank2)
|
63 |
|
64 |
vid2.write(blank2)
|
65 |
-
|
|
|
66 |
|
67 |
|
68 |
#Next is the text vid
|
@@ -116,6 +118,7 @@ def contourfinder(image1, image2, text=None):
|
|
116 |
text_vid.release()
|
117 |
|
118 |
text_frames(text,image,org)
|
|
|
119 |
|
120 |
|
121 |
-
contourfinder(original, original2, "spies gui Fly")
|
|
|
18 |
|
19 |
|
20 |
|
21 |
+
def contourfinder(image1, image2, text=None, num_frames=100):
|
22 |
#Create two blank pages to write into
|
23 |
blank = np.zeros(image1.shape, dtype='uint8')
|
24 |
blank2 = np.zeros(image1.shape, dtype='uint8')
|
|
|
30 |
|
31 |
threshold2=cv2.Canny(image=original2, threshold1=100, threshold2=200)
|
32 |
contours2, hierarchies2 = cv2.findContours(threshold2, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
|
33 |
+
|
34 |
|
35 |
#Initialize three empty videos
|
36 |
vid1 = cv2.VideoWriter('vid1.mp4',cv2.VideoWriter_fourcc(*'mp4v'), 24, threshold.shape)
|
|
|
52 |
|
53 |
#Complile to video
|
54 |
vid1.write(blank)
|
55 |
+
last_image1=blank
|
56 |
+
vid1.release()
|
57 |
|
58 |
positions=list_of_positions((len(contours2)))
|
59 |
|
|
|
63 |
frames.append(blank2)
|
64 |
|
65 |
vid2.write(blank2)
|
66 |
+
last_image2=blank2
|
67 |
+
vid2.release()
|
68 |
|
69 |
|
70 |
#Next is the text vid
|
|
|
118 |
text_vid.release()
|
119 |
|
120 |
text_frames(text,image,org)
|
121 |
+
return last_image1,last_image2
|
122 |
|
123 |
|
124 |
+
#contourfinder(original, original2, "spies gui Fly")
|