You can use the huffyuv encoder to create a lossless output:
ffmpeg -i img%d.jpg -vcodec huffyuv output.avi
or rawvideo:
ffmpeg -i img%d.jpg -vcodec rawvideo output.avi
By default this will assume your input frame rate is 25, so you can add an option to change it:
ffmpeg -r 30 -i img%d.jpg -vcodec huffyuv output.avi
By default the output will inherit the input frame rate. You can apply the same option to the output. By changing the frame rates you can achieve a certain duration. For example, if I have 900 images and want the output duration to be 60 seconds with an output frame rate of 30, then 900/60=15.
ffmpeg -r 15 -i img%d.jpg -r 30 -vcodec huffyuv output.avi
Note that your images must be named in a sequence starting with 1, and although some encoders are lossless there can be some loss due to colorspace conversion. See FFmpeg FAQ: How do I encode single pictures into movies? (http://ffmpeg.org/faq.html#SEC14) for more info.
credit : https://ubuntuforums.org/archive/index.php/t-1815998.html
credit: https://stackoverflow.com/questions/44598124/update-frame-in-matplotlib-with-live-camera-preview
credit: https://stackoverflow.com/questions/28682985/temporal-median-image-of-multiple-images
credit: https://stackoverflow.com/questions/35215161/most-efficient-way-to-map-function-over-numpy-array
credit: https://stackoverflow.com/questions/46441893/connected-component-labeling-in-python
credit: https://stackoverflow.com/questions/42798659/how-to-remove-small-connected-objects-using-opencv
https://stackoverflow.com/questions/13166914/linear-interpolation-using-numpy-interp
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.apply_along_axis.html
https://stackoverflow.com/questions/1987694/how-to-print-the-full-numpy-array
https://unix.stackexchange.com/questions/24014/creating-a-gif-animation-from-png-files
http://pythonhosted.org/scikit-fuzzy/auto_examples/plot_tipping_problem_newapi.html