Extension:Semantic Image Annotator

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type Page action, Ajax
DescriptionTemplate:Extension#description Allows to add semantic annotations to images
Author(s)Template:Extension#username Felix Obenauer (Feobtalk)
Latest versionTemplate:Extension#version 0.6.0 (2014-04-03)
MediaWikiTemplate:Extension#mediawiki 1.17+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GPL
Hooks usedTemplate:Extension#hook

Translate the Semantic Image Annotator extension if it is available at translatewiki.net

Check usage and version matrix.

The Semantic Image Annotator extension for Semantic MediaWiki was developed within the research project SMW-CorA and funded by the DFG that allows you to add customized semantic annotations to images in your wiki. It requires SemanticForms and Semantic MediaWiki to work.


You can download the extension directly from the MediaWiki source code repository (browse code). You can get:

After you've got the code, save it into the extensions/SemanticImageAnnotator directory of your wiki.

If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticImageAnnotator.git


  • Download and place the file(s) in a directory called SemanticImageAnnotator in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/SemanticImageAnnotator/SemanticImageAnnotator.php";
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


After the installation, you have to create a Template and a Form to work with Semantic Image Annotator. The form has to have the name Form:ImageAnnotation and it is good practice to call the corresponding Template the same. More information on using Semantic Forms can be found on its extension page. A good starting point is the Quick start guide.


This is a brief introduction on how to use the Semantic Image Annotator. A more detailed guide will appear on this page in the near future.

Creating annotations[edit]

After Successful installation, the button Annotate this image will appear above images on their File: page. Clicking this button will start the "annotation mode". You are then able to draw rectangular annotations on the image. Clicking once will start the shaping mode, in which you can move your mouse to create any rectangular shape. Clicking again stops the shaping mode and you can decide to accept or discard the rectangle that you have created. If you are happy with the annotation shape and click OK, a Semantic Forms popup window with the form that you have created will appear. In this window, you can specify the details of your annotation.

Displaying annotations[edit]

To display annotations that you have created, you use the Semantic MediaWiki ask parser functions with the result format imageannotation. If you want to display every annotation for a particular image, you can query for the special property SIAannotatedImage, giving the file name as its value. So for example if you have an image called Spieler.png, your query would look like this:

{{#ask: [[SIAannotatedImage::Spieler.png]]

If you have created a form/template that stores additional properties for the annotations, you can also simply query for these properties. If your query returns annotations for multiple images, they are all displayed (see Planned features). You can also specify the parameter width= and give an integer number to scale the images width to this size (in pixels):

{{#ask: [[SIAannotatedImage::Spieler.png]]

How it works[edit]

Semantic Image Annotator defines a custom namespace for annotations (ImageAnnotation:). Each annotation is stored as a unique page in this namespace. Semantic Image Annotator also defines a few custom properties that are added to an image annotation page that are necessary to correctly store and retrieve annotations:

The name of the image file that this annotation belongs to.
The coordinates, relative to the image dimension, at which the annotation is drawn.
The url (relative to the wiki) at which the annotated image is stored.
The user that created the annotation.

YouTube Video showing Semantic Image Annotator (~5:00).

Future development[edit]

The Semantic Image Annotator is still under heavy development. Feedback, bug reports and feature requests are therefore very welcome! Using the discussion page is a very good way to get in touch with the developers and maintainers of Semantic Image Annotator

Upcoming features[edit]

These are features that are at the top of the priority list and will be implemented shortly:

  1. Configurable Namespace Number for the ImageAnnotation Namespace
  2. Different handling for queries that return annotations for multiple images

Planned features[edit]

These features are planned already and will be implemented in the near future:

  1. Modifying annotation shapes
    1. Dragging annotations to a different position
    2. Resizing annotations
  2. Add different shapes, e.g. circles and custom shapes
  3. Define custom colors for annotation shapes

Known issues[edit]

If you find a bug, please report it on the discussion page.