4
$\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$
4
$\begingroup$

The following defines the URL where the image is located, imports it and checks it 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.