76 image comparison
Comparing images with an interactive slider
Uncomment the following line to install leafmap if needed.
Note that the image_comparison
will only work with Jupyter Notebook or JupyterLab. It seems not working with Visual Studio Code.
In [1]:
Copied!
# %pip install -U leafmap
# %pip install -U leafmap
In [2]:
Copied!
import leafmap
import leafmap
In [3]:
Copied!
img1 = "https://open.gishub.org/data/images/berkeley.jpg"
img2 = "https://open.gishub.org/data/images/berkeley_sam.jpg"
img1 = "https://open.gishub.org/data/images/berkeley.jpg"
img2 = "https://open.gishub.org/data/images/berkeley_sam.jpg"
The labels might not show up the first time. Try running the code block again to show the labels.
In [4]:
Copied!
leafmap.image_comparison(
img1,
img2,
label1="Satellite Image",
label2="Image Segmentation",
starting_position=50,
out_html="image_comparison.html",
)
leafmap.image_comparison(
img1,
img2,
label1="Satellite Image",
label2="Image Segmentation",
starting_position=50,
out_html="image_comparison.html",
)