
Recherche avancée
Autres articles (108)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
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 (15609)
-
how to improve edge interpolation of rotation in moviepy
15 juillet 2021, par OneWorldI tried changing the interpolation method of rotation from 'bilinear' to 'bicubic' in the below, but it didn't seem to improve the edge interpolation. (it still looks a little bit jagged)


I was wondering what I need to do to improve this ?


import moviepy.editor as mped
import sys
import numpy as np

bgrd_width = 200
bgrd_height = 200
sunset = mped.ImageClip("sunset200x100.jpg", duration=1).set_position((1, 1))
bgrd = mped.ColorClip(size=(bgrd_width, bgrd_height), color=np.array([200, 200, 200]).astype(np.uint8), duration=3).set_position((0, 0))

angle = 56
interpolation = 'bicubic'

rotated_sunset = sunset.add_mask().rotate(angle, unit='deg', expand=True, resample=interpolation).set_duration(3)
stacked_clips = mped.CompositeVideoClip([bgrd, rotated_sunset], size=[bgrd_width, bgrd_height])

stacked_clips.write_videofile(f'sunset_rotated_{angle}_{interpolation}.mp4', fps=5)




See attached comparison image of bilinear and bicubic interpolation.



Adding to this, I have seen now that the inside of the image does improve in quality with cubic, compared with nearest neighbour.




The reason for the smooth inside, and jagged asset edge is because there's no pixel to sample from outside the boundary of the image, when interpolation is applied.


I wrote some moviepy code, which adds a black margin (which actually turns transparent) and mask and then rotates. With bicubic interpolation it creates course, black lines, with a strange blend. However, with bilinear interpolation, the lines are much less apparent.


# Add margin, add mask, rotate with interpolation of transparent 2 pixel border.
original_clip = mped.ImageClip("sunset200x100.jpg")
opaque_color = np.array([255, 255, 255]).astype(np.uint8)
margin_color = np.array([0, 0, 0]).astype(np.uint8)
margin_added_clip = original_clip.margin(2, color=margin_color) # adds 2 pixel black border.
color_mask = mped.ColorClip(size=(original_clip.size), color=opaque_color).margin(2, color=margin_color)
mask = color_mask.to_mask() # converts to grayscale with values between 0 and 1
masked_clip = margin_added_clip.set_mask(mask) # adds the float mask to the clip
rotated_sunset = masked_clip.rotate(56, unit='deg', expand=True, resample="bicubic")
rotated_sunset.save_frame("sunset_rotated_56_degrees_moviepy_with_2px_mask.png") # uses imageio to save the frame.





However,


If you switch from bicubic to bilinear, it looks a lot better :-




-
OpenCV3 returning float FRAME_COUNT
15 mars 2016, par mpratI am using OpenCV3 on OSX with Python 2.7 bindings. However, when I try to read the frame count of my video (a .mp4 video), it returns a float - I am expecting an int. Do I need to compile OpenCV3 with some special flags ? Am I missing some codecs ?
import cv2
vid = cv2.VideoCapture("vid.mp4")
print vid.get(cv2.CAP_PROP_FRAME_WIDTH)And it returns a float.
Installation details :
- ffmpeg :
brew install ffmpeg --with-dcadec --with-openh264 --with-openjpeg --with-openssl --with-tools --with-x265 --with-zimg --with-libvidstab --with-libvpx
- opencv3 :
brew install opencv3 --with-ffmpeg --with-contrib
- ffmpeg :
-
gst-inspect-1.0 do not see avdec_h264
16 octobre 2020, par Marat ZakirovPreviously I installed gstreamer via conda and its (good) plugins
next I installed gst-libav via
sudo apt-get install gstreamer1.0-libav
next I usedapt-file list gstreamer1.0-libav
to see installation path and found it to be/usr/lib/x86_64-linux-gnu/gstreamer-1.0/
next I read running gstream manual and then

GST_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gstreamer-1.0/ gst-inspect-1.0 avdec_h264

(base) marat@user-System-Product-Name:~$ ls -lh /usr/lib/x86_64-linux-gnu/gstreamer-1.0/ | grep av
-rw-r--r-- 1 root root 181K мар 21 2020 libgstavi.so
-rw-r--r-- 1 root root 56K мар 21 2020 libgstinterleave.so
-rw-r--r-- 1 root root 251K дек 9 2019 libgstlibav.so
-rw-r--r-- 1 root root 15K мар 21 2020 libgstnavigationtest.so
-rw-r--r-- 1 root root 40K мар 21 2020 libgstwavenc.so
-rw-r--r-- 1 root root 48K мар 21 2020 libgstwavpack.so
-rw-r--r-- 1 root root 72K мар 21 2020 libgstwavparse.so



It found many new modules but didn't found avdec_h264. What I am missing ?


UPDATE :


I just want way to use gstreamer via conda virtenv python appliation. If you know valid way to do so I will consider your reply as answer.