Mobile app version of vmapp.org
Login or Join
Dunderdale640

: Remove graph/grid background from a ECG-like readout in inkscape/ImageJ I have this graph below, which shows a readout for an experiment on a graph background like this; I would like to remove

@Dunderdale640

Posted in: #Background #BackgroundRemoval #ImageEditing #Images #Inkscape

I have this graph below, which shows a readout for an experiment on a graph background like this;



I would like to remove this graph background, leaving just the black line, so that it is formatted like this;

I tried to do this in powerpoint using the 'remove background' option, thinking that powerpoint would be able to distinguish the black line from the red and white background, but no. I have fumbled about with different options in inkscape and imagej, but am not really sure what to do. I don't have access to adobe softwares, so if answers could apply to inkscape/imagej, that would be greatly appreciated.

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Dunderdale640

4 Comments

Sorted by latest first Latest Oldest Best

 

@Margaret771

These are obviously plots on paper. If you can rescan them or take new photos in good light, that really would pay off. Poor contrast and non-uniform light makes all quite tiresome. Uniformly lighted high contrast images are easily traced in Inkscape but these will provide garbage. Two workarounds are already shown:


trace in pieces and combine
draw it with the pen


I suggest doing the job in a photo editor (Photoshop, GIMP) as a way out having only that one image:


Make the red graticule as light as possible and desaturate it. Use Hue/Saturation tool selectively. Adjust the saturation to the minimum, find the range selector slider positions which take all of the red and drag the lightness slider to maximum:





There's still left much remnants of the graticule. Fortunately they everywhere have finer grain and they are lighter than the curve - at least when compared to the nearest part of the curve. Apply Filter > Blur > Smart Blur to smooth fime grains but leaving strong local contrasts intact (two images, one for settings and another for the result):






This can already be useful, but let's make it closer to the ideal (=black curve on white background). Tresholding cannot be applied because the brightness is too different in left and right. It must be balanced, add brightness to the darker areas. This can be done in several ways:


insert a gradient layer with blending mode = Add.
the same, but create the gradient by making a heavily blurred and inverted copy, fix the edges manually
insert an adjustment layer for levels or curves and find the balance with gradient in layer mask


Let's try the first version. Have a gradient from black (left) to 50% grey (right) in a new layer that has blending mode =Add:



That needs a little fine-tuning. Spray to the gradient a little black with large smooth low opacity brush to take back the overwhitened top right corner.The unwhitening is done most easily after the next step:

Add a levels layer to lift light grey to white and pushing the dark grey down to black:



There are still a couple pieces of garbage, but they are far from the curve. Use eraser to fix them.

Finally, if it's wanted, it can be traced in Inkscape. Single treshold BW won't be ok, because there are greyshades => Tracing mode should be greyscale with at least 4 levels.

10% popularity Vote Up Vote Down


 

@Hamaas979

It's certainly possible in Inkscape. However the main problem is that the original image is darker at one side than the other.

If you trace the bitmap image using Path > Trace Bitmap, choose the Brightness Cut Off option, you can alter the Threshold. But I had to create two copies using different Thresholds to get an acceptable trace of each side.

Then it's a simple case of using a clipping mask made from a rectangle to create two acceptable halves, which can then be put together.

10% popularity Vote Up Vote Down


 

@Smith574

I didn't initially notice the inkscape tag, though I'm sure it has similar (if not same) tools and it could work.



I would use Photoshop and adjust the levels.


If you first convert the image to grayscale (Image → Mode → Grayscale) there won't be any color


Now doing this will leave some color there.



Using Black and white filter to remove the excess coloring (I dragged the yellows and reds to white)



Now use some manual touch up (brush work or eraser) to get this:

10% popularity Vote Up Vote Down


 

@Hamaas979

Try using the pen tool.

Looks like Inkscape has a pen tool similar to Illustrator's.

Place your image in Inkscape and lock it down (if you can). Then take the pen tool and "trace" the image. Do this by clicking each point to form the shape on the graph paper.

This might take you a bit to get done, but the result should be what you're looking for.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme