
Recherche avancée
Autres articles (10)
-
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (2203)
-
vf_colorspace : Interpret unspecified color range as limited range
19 septembre 2016, par Vittorio Giovaravf_colorspace : Interpret unspecified color range as limited range
This is the assumption that is made in pixel format conversion do
throughout the code (in particular swscale), and BT-specifications
mandate.Add a warning to inform the user that an automatic selection is being
made.Signed-off-by : Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by : Ronald S. Bultje <rsbultje@gmail.com> -
Révision 21338 : Report de c21337 : Ne pas confondre le Kazakh (kk - http://fr.wikipedia.org/wiki...
5 mai 2014, par kent1 - -
Matplotlib : Live animation works fine but displays a blank plot when being saved
18 juillet 2017, par Loïc PoncinI made a little forest fire animation. My code is at the end of the question.
Here is some information before I ask my question :
- No tree :
forest[i,j] = 0
- A tree :
forest[i,j] = 1
- A tree on fire :
forest[i,j] = 2
Basically what happens is that
constructforest
creates a 2 dimensional array calledforest
of size n by m with a probability of tree occupancy called p. After thatsetonfire
sets on fire theforest
and while theforest
can burnspreadfire
spread the fire.When I run
forestfire
with thePython prompt
or theIPython prompt
I get a nice animation but when I go check the video file that I saved I only see a blank plot.I did some research, I found many questions about this issue but none of the advice I read was helpful :
- matplotlib animation produces a blank
- Matplotlib animation not working in IPython Notebook (blank plot)
- Animation from matplotlib not working in spyder
- Spyder Python Animation not working
Can someone tell me what is going on please ?
forestfire.py
from random import random
import numpy as np
import matplotlib.pylab as plt
import matplotlib.colors as mcolors
import matplotlib.animation as animation
def hazard(p):
r=random()
assert p>=0 and p<=1
return r <= p
def constructforest(n,m,p):
forest = np.zeros((n,n))
for i in xrange(n):
for j in xrange(m):
if hazard(p):
forest[i,j] = 1
return forest
def setfire(forest,i,j):
forest[i,j] = 2
return forest
def spreadfire(forest):
n,m=forest.shape
c = np.copy(forest)
for i in xrange(n):
for j in xrange(m):
if c[i,j] == 1:
Y, X = xrange(max(0,i-1),min(n,i+2)), xrange(max(0,j-1),min(m,j+2))
for y in Y:
for x in X:
if c[y,x] == 2:
forest[i,j] = 2
return forest
def canburn(forest):
n,m=forest.shape
c = np.copy(forest)
for i in xrange(n):
for j in xrange(m):
if c[i,j] == 1:
Y, X = xrange(max(0,i-1),min(n,i+2)), xrange(max(0,j-1),min(m,j+2))
for y in Y:
for x in X:
if c[y,x] == 2:
return True
return False
def forestfire(forest):
fig, ax = plt.subplots()
movie = []
# Colormap
red, green, blue = [(1,0,0,1)], [(0,1,0,1)], [(0,0,1,1)]
colors = np.vstack((blue, green, red))
mycmap = mcolors.LinearSegmentedColormap.from_list('my_colormap', colors)
# Initialization
k = 0
forest = spreadfire(forest)
im = plt.imshow(forest, animated=True, cmap = mycmap, interpolation="none", origin='lower')
movie.append([im])
# Fire propagation
while canburn(forest):
k += 1
print k
forest = spreadfire(forest)
im = plt.imshow(forest, animated=True, cmap = mycmap, interpolation="none", origin='lower')
movie.append([im])
return animation.ArtistAnimation(fig, movie, blit=True, repeat_delay=100)
ani = forestfire(setfire(constructforest(101,101,0.4),50,50))
ani.save("forestfire_test.mp4", writer = 'ffmpeg', fps=5, dpi=500)EDIT
As requested by @Y.Luo by @ImportanceOfBeingErnest in the comments I downgraded matplotlib to 2.0.0 and I changed the framerate of the animation but
forestfire_test.mp4
still displays a blank plot. - No tree :