Plug-ins

Algorithms to manipulate images are externally implemented as plug-ins. The framework provides an interface to manipulate plug-ins. The following source code loads a gray scale plug-in and processes an image:

MarvinImage image = MarvinImageIO.loadImage(“test.jpg”);
MarvinPluginImage plugin = MarvinPluginLoader.loadPluginImage("net.sourceforge.marvinproject.color.grayScale.jar");
plugin.process(a_image, a_image, a_null, MarvinImageMask.NULL_MASK, false);

Plug-ins are loaded in run-time via reflection. It provides an easy-way to extensibility and allows plug-ins integration. A plug-in to show a gray scale histogram, for example, uses the gray scale plug-in before the histogram generation.

Video Capturing

Video capturing is provided via Java Media Framework and allows developers to work with real-time video processing. For the plug-ins, the interface to work with videos and images are the same. In the case of videos, plug-ins can store past frames to analize multiple frames.

Below is presented a real-time video filtering.

Video Sample



Multi-threading

Marvin allows the processing of multiple images at the same time or the same image processed by multiple threads. Image processing plug-ins receive an image to be processed and a mask containing what pixels must be considered. Thus, different threads can work in the same image in different image´s segment, illustrated as folow:

Input image.
Image-in Thread


Output image.
Image-out Thread


In the example presented above, the statiscal plug-in "Maximum" spent 632 and 369 milliseconds, respectively for one and two threads. The image resolution is 873x601 pixels and the computer used in the test was a AMD Turion 64x2.

Performance Meter

Many image processing algorithms can be divided in few processes. An algorithm, for example, may be divided in five processes to find and segment the interest points of an image: representing the image in gray scale, border detection, binarization, Harris/Plassey application, render red points representing interest points. Each process has a different computational cost and the performance meter allows developers to analyze the performance of the entire algorithm and their processes individually, considering the number of steps and the execution spent time. Thus, it is possible a better understanding of the algorithm performance and facilitates optimizations, since is visible what algorithm processes are costly and most interesting to be optimized. Another performance meter application is to determine the complexity of an algorithm, Big-O notation, analyzing the number of steps executed for different image resolution. The image below presents the informations provided by the performance meter for the plug-in "Interest points".

Performance Meter



GUI API

The plug-ins can have user specified attributes that determines how it works and the Marvin framework provides features to integrate a GUI (Graphical User Interface) with these attributes. The Plug-in developer sets the relation between the plug-in attributes and the interface components, added to the plug-in window. When the component value is changed, the associated attribute value is changed automatically. The developer does not worry about handling component events or update the attributes. Below are an example of using GUI API:

public void show(){ MarvinFilterWindow l_filterWindow = new MarvinFilterWindow("Brightness and Contrast", 400,350, getImagePanel(), this); l_filterWindow.addLabel("lblBrightness", "Brightness"); l_filterWindow.addHorizontalSlider("sliderBrightness", "brightness", -127, 127, 0, attributes); l_filterWindow.addPanelBelow(); l_filterWindow.addLabel("lblContrast", "Contrast"); l_filterWindow.addHorizontalSlider("sliderContrast", "contrast", -127, 127, 0, attributes); l_filterWindow.setVisible(true); }

The code above creates a new MarvinFilterWindow that implements a thumbnail and buttons to preview, reset and apply a filter. The buttons preview and reset call the method process implemented in the plug-in. Two horizontal sliders are added to that windows, one associated with the attribute brightness and the other with contrast. The result window is presented below:

Bringhtness and Constrast Window



Plug-in History

In some cases to achieve some result in an image, it is necessary to use a few processes. Preparing an image for pattern recognition, for example, in some applications it is interesting to remove noise, increase contrast and emphasize edges. For these cases that multiple processes are used, MarvinPluginHistory stores all plug-ins and their configurations applied to an image. The history can be exported as an image strip containing the configuration and resulting images of each used plug-in. This feature allows an analysis of an entire process considering each step. Other application is the comparison of the same application but with different settings. Below are an example of plug-in history:

Plug-in History