immarkus icon indicating copy to clipboard operation
immarkus copied to clipboard

Feature request: physical measurements

Open JorenSix opened this issue 2 months ago • 2 comments

First of all, congratulations on v1.0! ImMarkus has become a very well-rounded tool, and adding the automatic transcription services really makes it practical for OCR as well. There is however a request that comes up here now and again which might be of interest. Thanks already for considering this request.

Problem Statement

When working with digitized historical documents, manuscripts, papyri, and other material culture, researchers often need to record physical dimensions in addition to identifying and annotating content. Currently, scans frequently include physical reference scales (rulers, measurement bars) placed alongside the object during digitization. However, there is no standardized way to leverage these references to express annotation coordinates in absolute physical units rather than just pixels or relative percentages.

For researchers working with material objects like the papyrus fragment shown attached, being able to annotate and query:

  • Physical dimensions of the entire object
  • Line heights and spacing
  • Character sizes and dimensions
  • Margin widths
  • Inter-column spacing
  • Damage extent in centimeters/millimeters

...would significantly enhance the scholarly value of annotations and enable new forms of comparative material analysis.

The current way where the physical measurement is encoded in text associated with an image is not great, since it does not make measuring and interpreting straightforward.

Proposed Solution

Implement a Ruler Tool that allows users to set a physical measurement reference on any image, enabling all subsequent annotations to be interpreted in absolute physical units in addition to pixel/relative coordinates.

Implementation Levels

Of course these are simply suggestions and might be more or less doable depending on the internal structure of IMMARKUS and are simply here for documentation purposes

Level 1: Basic Ruler Calibration (Essential)

User Workflow:

  1. User selects "Ruler Tool" from the Smart Tools menu (alongside Smart Scissors, Edge Snap, etc.)
  2. User draws a line segment along a visible reference ruler/scale in the image
  3. User inputs the known physical length of that segment (e.g., "10 cm", "100 mm", "5 inches")
  4. System calculates and stores the pixels-per-unit ratio for that image
  5. A small indicator (e.g., "Scale: 1cm = 89.3px") appears in the image metadata, annotation?

Display Options:

  • Show/hide ruler calibration line
  • Display scale factor in image metadata panel
  • Option to recalibrate if needed

Level 2: Measurement Display on Annotations (Intermediate)

Enhanced Annotation Display:

  • When ruler calibration is active, show physical measurements alongside/instead of pixel dimensions
  • For bounding boxes: display width × height in calibrated units (e.g., "2.3cm × 4.1cm")
  • For polygons: display perimeter and area in physical units
  • For line paths: display length in physical units
  • Display measurements as overlays (toggleable) or in the annotation properties panel

Example Use Cases:

  • Measuring papyrus fragment: "Fragment dimensions: 8.7cm × 12.4cm"
  • Line height measurement: "Line spacing: 4.2mm average"
  • Character size: "Initial letter height: 11mm"
  • Margin measurement: "Left margin: 1.8cm"

Level 3: W3C Annotation Encoding?

Standards Compliance:

  • Encode physical measurement calibration in W3C Web Annotation format
  • Store calibration data in annotation metadata using appropriate ontologies
  • Encode SVG selectors with both pixel and physical coordinate systems

Example W3C Annotation with Physical Measurements:

{
  "@context": "http://www.w3.org/ns/anno.jsonld",
  "id": "https://example.org/annotations/1",
  "type": "Annotation",
  "body": {
    "type": "TextualBody",
    "value": "Fragment dimensions",
    "purpose": "describing",
    "format": "text/plain"
  },
  "target": {
    "source": "https://example.org/papyrus/P0214",
    "selector": {
      "type": "SvgSelector",
      "value": "<svg>...</svg>",
      "dimensionality": "physical",
      "units": "http://qudt.org/vocab/unit/CentiM",
      "calibration": {
        "pixelsPerUnit": 89.3,
        "referencePixels": [100, 200, 993, 200],
        "referenceMeasurement": {
          "value": 10,
          "unit": "http://qudt.org/vocab/unit/CentiM"
        }
      }
    },
    "physical": {
      "width": {"value": 8.7, "unit": "cm"},
      "height": {"value": 12.4, "unit": "cm"}
    }
  }
}

Benefits for Researchers

This feature would enable:

  • Material Analysis: Facilitate codicological and paleographic studies with standardized measurements
  • Reproducibility: Physical measurements independent of scan resolution
  • Interoperability: W3C-compliant encoding allows data reuse across platforms
  • Publication Ready: Measurements can be directly cited in scholarly publications

Example Use Case

The papyrus fragment example shows an ideal scenario - a clear ruler reference at the bottom showing 10 full centimeters. With this feature, researchers could precisely measure character dimensions, line spacing, margin sizes, and fragment dimensions in absolute units rather than just pixels.

See the image here: https://berlpap.smb.museum/record/?result=9&Startdatum=201&Enddatum=300&Textgattung=literarisch&lang=en

JorenSix avatar Oct 22 '25 07:10 JorenSix

As an example implementation the following leaflet demo shows already advanced capabilities with areas automatically calculated as well: https://geoman.io/docs/leaflet/options/measurement

Another, more basic measurement tool can be found here. Perhaps labeling and annotating silicon die shots is not the first concern of IMMARKUS but to me it seems like a good match: https://siliconprawn.org/map/unknown/mn53007tqa/furrtek_mz/

JorenSix avatar Oct 22 '25 13:10 JorenSix

This sounds like a great idea. I put it on the backlog for now, but think it makes a lot of sense for many use cases. (Also: I believe resolution information might sometimes be part of a IIIF manifest even? In this case, physical dimensions could be calculated even without the user providing a "manual" measurement first.)

rsimon avatar Oct 24 '25 06:10 rsimon