Showing posts with label WolframEngine. Show all posts
Showing posts with label WolframEngine. Show all posts

Jan 26, 2023

ImageStitch, aerial photos and a surprise

Aerial photos are usually taken with overlaps, it is a perfect application for ImageStitch to generate a mosaic of the aerial photos from one flight line.

First, let's import the photos from FlightLine 3196it is somewhere in Antarctica. The data is from the Center for Remote Sensing and Integrated Systems (CReSIS). 

There are 12 images:

Then run ImageStitch on the imported images, on Mathematica 13.0.1, the result is the following, clearly something wrong.


For the reference, the image from Google Earth, 

The plan was to extend the function from the previous post on ImageStitch, we only need a function to work with two images, then we can use Fold function to apply it incrementally over all the images, since the photos are taken in a sequence, for example:

imagelist = {image1, image2, image3, imaga4};

Fold[ourimagestitch[#1, #2] & , imagelist[[1]], imagelist[[2 ;;]]] 

===>

ourimagestitch[ourimagestitch[ourimagestitch[image1, image2], image3], imaga4] 

 A Surprise

Mathematica 13.2 is out, ImageStitch function is updated. Our organization only has the license for 13.0.x version right now. So, I downloaded Mathematica Engine 13.2, run the same code in Jupyter Notebook, the result is great.


Kudos to the developer!

Jupyter Notebook: ImageStitch and Aerial Photos


Mar 28, 2022

Using Wolfram Engine with Jupyter Notebook

I’ve been using the free Wolfram cloud for a while; it is actually very capable for small projects. Several tips:

  1. It can’t upload any files, put the data somewhere online, then use Import[url] to get the data

  2. Each command can only run in a limited time (several minutes?), and sometimes reducing the size of data can help the job run through, for example, ImageResize[image,Scaled[1/2]].

  3. Learn some keyboard shortcuts, especially on cell formatting: Keyboard Shortcut Listing for the Wolfram Cloud.

  4. The most important thing: download your notebooks and also save a pdf copy. The file expires after 60 days, the user can’t open and download the expired files.


You probably can guess what happened to my files, they are all expired. I am not complaining here, it is free service anyway. To avoid this issue, I decided to try Free Wolfram Engine with Jupyter Notebook. They can be connected by WolframLanguageForJupyter. I am not going through the installation part; it is well documented for each product. I’ve created a sample notebook ImageStitch.ipynb with JupyterLab (a better interface than the classic Jupyter notebook). (Note: if it doesn’t load properly, try to reload it again). I may try other connectors later, the one used here is directly from Wolfram, however it doesn’t support auto-completion.