Consider the following image:
I would like to remove the entire background (everything that does not belong to the) to be left only with the integral. My purpose is to make it easier to get the integral in LaTeX from OCR.
Is this what you want? Using Imagemagick, I do a division normalization followed by a thresholding.
Input:
convert image.png \( +clone -blur 99 \) +swap -compose divide -composite -negate -threshold 18% -negate result.png
Adjust the threshold as desired.
ADDITION
Add morphology to thicken the lines
convert image.png \( +clone -blur 99 \) +swap -compose divide -composite -negate -threshold 25% -negate -morphology erode diamond:1 result.png