
Grasping the essence of image processing and analysis algorithms may prove to be quite difficult. To simplify the comprehension of such algorithms, sugarcubeIT proposes ImaproFX, a Java FX user interface providing live visual feedback thanks to interactive controllers.
The real power of ImaproFX comes from it’s Java coding framework… Coders can create their own image analysis ribbons simply by extending and implementing an abstract “ImaproFilterFx” class :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
public class ContrastFilterFx extends ImaproFilterFx { public @FXML Slider contrastSlider, luminositySlider; public @FXML CheckBox invertCheckbox; public ContrastFilterFx(FxEnvironment env) { super(env, "Contrast & Luminosity"); } @Override public void reset() { contrastSlider.setValue(0); luminositySlider.setValue(0); invertCheckbox.setSelected(false); } @Override public void process(FilterImage image) { double contrast = Math.tan((0.5 + contrastSlider.getValue() / 200) * Math.PI / 2.0); double luminosity = luminositySlider.getValue() / 100; if (invertCheckbox.isSelected()) contrast = -contrast; for (int y = 0; y < image.getHeight(); y++) for (int x = 0; x < image.getWidth(); x++) { float value = (float) ((image.getValue(x, y) - 0.5f) * contrast + 0.5f); if (value > 1) value = 1; else if (value < 0) value = 0; image.setValue(x, y, value + luminosity); } } } |
Post written by Jean-Luc Bloechle