uh hello guys uh welcome to this video
so in this video I will show you how to
animate a bunch of images which is
present inside a directory uh in Open CV
with multiple transition effects and
animations let me just launch the
application right here from the terminal
so you will see it's a simple Python
script which will animate all these
images inside a window with the multiple
transition effects so let me just launch
this
application so now you can see that each
image will appear for 3 seconds and then
it will go away with uh random
transition animation effects it's a
slideshow you can see it will navigate
to the next
image so all these images which are
present right here in the directory one
by one each image will appear and as you
can see you can build out this nice
little
slideshow inside the open CV so then
automatically it will
close so all the script I have given in
the description of the video so for
building this you need quite a uh lot of
packages so first of all you just need
to install Open CV
so Open CV- Python this is the first
module that you need to
install secondly you also need the NumPy
module as
well so also install this as well i've
already installed both these modules so
now I will show you from scratch how to
build this
so all the source code will be given in
the description of the video so first of
all just you need to require the
necessary packages so we will require
the open CV package and numpy 2 numpy
package as well then we need the
operating system module the time module
and the random module as
well so these are built-in modules
and after that we need
to
actually
define inside the main
function so right here we will
simply define a set of
animations or transition effects that
will be applied
automatically whenever we will be making
so with first will be horizontal scroll
second will be vertical
scroll then we'll be also be rotating
the
image zooming in so these are random
animation effects that will be applied
fading image so we have just defined it
inside this array of animations then we
just need to get the image files which
are present so for this I will just
write a simple function get image files
so all my image files as you can see it
is present in the home directory so you
can just pass the directory where all
your images are present after that I
just need to define this function here
which is get image
files it will essentially go to this
directory and return all the images
which are supported extensions jpg png
bmp jpg so once you get all your image
files you can simply loop through like
this and for each image we can read this
image by the open CV method image read
after reading it we
will basically apply the
animation using the random module so we
are applying the random animation using
that animations array I is equal to zero
and we'll be applying the starting
time time dot time and inside this uh
while
loop we will just increment the value of
i by one so after each image I will
increment the value of i and then we
will apply this
animation
it image
I each frame so after this we will show
this image inside the window by this
image show method so this will be a sim
title of the window will be image
slideshow and the frame will be shown so
then we will wait for certain amount of
time here so this is set to
10 so here we are waiting for each
image and then we are navigating to the
next image so here we are binding
some shortcuts so if you press the Q
keyboard Q key on the keyboard your
application will close and then we are
showing the animation for 3 seconds and
then we are breaking to the next
image so you can see we are showing the
animation for 3 seconds and then we are
breaking
it so then we are destroying all the
windows coming out of this
loop so that's all that is needed for
this application so now we just need to
define all these five animations that we
have defined here which is horizontal
scroll vertical scroll rotate image
these are all the five functions i have
given all the source code in the
description of the video
so so these are all the five functions
which are there so I will just define
this and explain you what is happening
so we are just applying the OpenCV
animations all these animations and
effects are supported by Open CV so you
can see zooming in rotating this image
like this vertical scroll horizontal
scroll all that
stuff
so this is essentially this if you you
will see it is saying on line number 49
image is not defined
so this will be
image files
sorry so now you can see it is appearing
it for 2 seconds and then it's
navigating to the next image with all
these cool little transition and
animating effects right
here it is also rotating fading zooming
in on a particular image so you can do
this very easily inside OpenCV and numpy
so all the source code is given in the
description of the video uh thank you
very much for watching this video and
also check out my website
freemediatools.com
uh which contains thousands of tools