6
$\begingroup$

NASA released a panorama image of Mars taken by the Perseverance Navcams 360-Degree Panorama Camera on February 22, 2021.

I would like to have that image as an animated background for my Zoom meetings, for that I would like to scan the panorama over a nice path.

Question:

How to transform an image into a video panning over the large picture?

Accepted formats are MP4 and MOV.

enter image description here

$\endgroup$

2 Answers 2

4
$\begingroup$

There are other solutions that do not require generating all the frames in advance. Using the same path as a previous solution, you could use AnimationVideo (Experimental V12.3) which can be parallelized:

pathfunct[t_] := {1 Sin[t], -0.7 + 0.15 Cos[t]}

imagesize = {800, 600};
Parallelize@
 AnimationVideo[
  ImageCrop[panimg, imagesize, pathfunct[t]], {t, 0, 2 \[Pi]}, 
  DefaultDuration -> 10, FrameRate -> 60]

Or if the panning can be described by a list of positions you can use TourVideo (V13):

TourVideo[panimg, {<|"Position" -> Scaled[{.2, .5}], 
   "Width" -> 500|>, <|"Position" -> Scaled[{.8, .5}], 
   "Width" -> 1000|>}]
$\endgroup$
4
$\begingroup$

This answer was rendered obsolete by the new functions AnimationVideo(Experimental V12.3) and TourVideo (V13.0), which were not available to me at the time of posting this solution. See the answer by @carlog


The following defines the URL where the image is located, imports it and checks its size

panimg = With[
   {
    imgurl = 
     "https://mars.nasa.gov/system/resources/deepzooms/25622_1_-_\
PIA24422_-_Navcam_360_-_Maki_7_Navcam_360_08_N_LRGB_0002_RAS_0010052_\
CYL_S_UNCORCLJ01-stretched-v2.png"
    }
   , Import[imgurl]
   ];
ImageDimensions[panimg]

A reasonable function to pan the image is an oval

pathfunct[t_] := {1 Sin[t], -0.7 + 0.15 Cos[t]} 

We select the region preview the video using ImageCrop and preview the video using Animate

With[
 {
  imagesize = {800, 600}
  },
 Animate[
  ImageCrop[panimg, imagesize, pathfunct[t]]
  , {t, 0, 2 \[Pi], \[Pi]/2048}
  , AppearanceElements -> All
  , DisplayAllSteps -> True
  , AnimationRate -> 60
  ]
 ]

Finally, we create a list of frames using Table and Export

frames =
  With[
   {
    imagesize = {800, 600}
    },
   Table[
    ImageCrop[panimg, imagesize, pathfunct[t]]
    , {t, 0, 2 \[Pi], \[Pi]/2048}
    ]
   ];

Export[
 "Mars-Panorama.MP4"
 , frames
 , AppearanceElements -> All
 , DisplayAllSteps -> True
 , AnimationRate -> 60
 ]

The new file can be used as background in Zoom.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.