Turn labels into squares/ Smoothing of edges

Hello everybody!

Currently I am using KNIME for the detection of squared metal plates in images. Until now it is working quite well - my workflow is able to find the plates - but often the labels do include unwanted parts or leave out parts of the metal plate (I will add some example screenshots to make it clearer), so that the labels do not form a square. The images are quite noisy, so it's quite logical that the workflow is not able to detect the plates perfectly. 

Nevertheless, it would be great if I could turn the detected labels into squares or to smooth their edges automatically, so that they form a straight line. I tried that with some filters, but the results were not too satisfying. 

Does anybody has a suggestion on how I could achieve that with KNIME? I would be very lucky if there is a possibility! 

Thanks in advance :)

Hie synechocystis,

This is sadly not an easy task, you can try out the Morphological Labeling Operations nodes, but I was only able to smooth out the edges a bit, not get them completely straight. You could also ask in the ImageJ forum http://forum.imagej.net/ for help. It is visited by many image analysis experts and if they provide you with a e.g a ImageJ script based solution you can even use that within KNIME.

best,

Gabriel