Created
January 3, 2025 18:10
-
-
Save CnrLwlss/78aeeaedcc8bbf669f176906ba865bb7 to your computer and use it in GitHub Desktop.
Iterative construction of video from contiguous samples from static image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using VideoIO | |
using Images | |
download("https://live.staticflickr.com/4293/35896494470_6e106950d9_o_d.jpg","input.jpg") | |
img = load("input.jpg") | |
(h,w) = size(img) | |
function getframe(img, dx, dy, N, scaleup) | |
smimg = img[dy:(dy+(N-1)),dx:(dx+(N-1))] | |
bigpix = repeat(smimg, inner=(scaleup,scaleup)) | |
return bigpix | |
end | |
save("singleframe.png",getframe(img,1,1873,8,200)) | |
dy = 1873 | |
encoder_options = (crf = 0, preset = "veryslow") | |
open_video_out("video.mp4", getframe(img,1,dy,8,200), framerate = 12, encoder_options = encoder_options, codec_name = "libx264") do writer | |
for dx in 1:(12*60) | |
write(writer, getframe(img,dx,dy,8,200)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment