Skip to content

Commit 36ae334

Browse files
SlideShow of Images (same shaped images)
1 parent c5afacf commit 36ae334

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

ImageSlideShow.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Image Slide Show using addWeighted
2+
3+
import cv2
4+
import numpy as np
5+
import os
6+
7+
# Getting images from image base
8+
dst = "/home/siddharth/Desktop/PROGRAMS/Work/Opencv exercise/ 0. Image Base/"
9+
images = os.listdir(dst)
10+
length = len(images)
11+
12+
#print(images)
13+
14+
result = cv2.imread(dst + images[0])
15+
i = 1
16+
count = 0
17+
18+
# Slide Show Loop
19+
while(True):
20+
a = 1.0
21+
b = 0.0
22+
img = cv2.imread(dst + images[i])
23+
24+
# Image Transition from one to another
25+
while(int(b)!=1):
26+
result = cv2.addWeighted(result, a, img, b, 0)
27+
cv2.imshow("slideShow", result)
28+
a -= 0.0001
29+
b += 0.0001
30+
31+
i = (i+1)%length # Getting new image from directory
32+
33+
if cv2.waitKey(1) & 0xff == ord('q'):
34+
break
35+
36+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)