Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Combined morphological dilation and erosion using <a href="http://marvinproject.sourceforge.net" rel="nofollow noreferrer">Marvin</a> produced the result below:</p> <p><img src="https://i.stack.imgur.com/MyIZW.png" alt="enter image description here"></p> <p>Source code:</p> <pre><code>package characterRestoration; import marvin.image.MarvinColorModelConverter; import marvin.image.MarvinImage; import marvin.io.MarvinImageIO; import marvin.plugin.MarvinImagePlugin; import marvin.util.MarvinPluginLoader; public class CharacterRestoration { MarvinImage image = MarvinImageIO.loadImage("./res/character_in.png"); private MarvinImagePlugin dilation = MarvinPluginLoader.loadImagePlugin("org.marvinproject.image.morphological.dilation"); private MarvinImagePlugin erosion = MarvinPluginLoader.loadImagePlugin("org.marvinproject.image.morphological.erosion"); private boolean[][] matrixD = new boolean[][]{ {false,false,false,false,false,false,false,false,false}, {false,false,false,false,false,false,false,false,false}, {false,false,false,false,false,false,false,false,false}, {false,false,true,true,true,true,true,true,true}, {false,false,true,true,true,true,true,true,true}, {false,false,true,true,true,true,true,true,true}, {false,false,false,false,false,false,false,false,false}, {false,false,false,false,false,false,false,false,false}, }; private boolean[][] matrixE = new boolean[][]{ {true,true,true}, {true,true,true}, {true,true,true} }; public CharacterRestoration(){ // Convert image to binary format image = MarvinColorModelConverter.rgbToBinary(image, 125); // Morphological Dilation dilation.setAttribute("matrix", matrixD); dilation.process(image.clone(), image); // Morphological Erosion erosion.setAttribute("matrix", matrixE); erosion.process(image.clone(), image); MarvinImageIO.saveImage(image, "./res/character_out.png"); } public static void main(String[] args) { new CharacterRestoration(); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload