Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create an interface to accurately select points on an image
ResourceFunction["ImageLocatorPaneWithZoom"][Dynamic[pts], back] creates a LocatorPane with a zoom area around the mouse. |
"ShowZoomControls" | True | whether the additional controls are visible when the interface is created |
"ZoomLevel" | 2 | starting value of the magnification level of the zoom area |
"ZoomSize" | 0.15 | starting value of the scaled zoom area size (relative to the size of the image) |
"MarkerFunction" | Automatic | function that takes a color and returns Graphics[…] object to show the selected points |
"MarkerSize" | 0.02 | size of the point markers (relative to the size of the image) |
"MarkerColor" | Black | color of the selected points |
"ShowCoordinates" | True | whether to show coordinates in the zoom area |
Get an image:
In[1]:= |
Out[1]= |
Create an interface that allows you to select a point:
In[2]:= |
Points can be added or deleted with + click:
In[3]:= |
Out[5]= |
Use Graphics with Dynamic elements to add extra content to the image:
In[6]:= |
Out[7]= |
If you turn on the default locators with Appearance→Automatic, the locators will be drawn in the frame of the main image, so they will not appear in the correct position in the zoom area:
The coordinates of the points are not always on a scale natural to the image. Consider the ImageDimensions of this example image:
In[8]:= |
Out[9]= |
When converted to Graphics, the coordinates run over a different range:
In[10]:= |
Out[10]= |
To get coordinates corresponding to pixels, use ImageResolution→Automatic:
In[11]:= |
Out[11]= |
This work is licensed under a Creative Commons Attribution 4.0 International License