从数学公式图像中移除整个背景

huangapple go评论66阅读模式
英文:

Removing the entire background from a mathematical formula image

问题

我想要移除整个背景(除了积分部分),只保留积分部分。我的目的是为了从OCR中更容易地获取LaTeX格式的积分。

英文:

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.

答案1

得分: 1

这是您想要的吗?使用Imagemagick,我进行了除法归一化,然后进行阈值处理。

输入:

从数学公式图像中移除整个背景

convert image.png \( +clone -blur 99 \) +swap -compose divide -composite -negate -threshold 18% -negate result.png

从数学公式图像中移除整个背景

根据需要调整阈值。

附加操作

添加形态学操作以加粗线条

convert image.png \( +clone -blur 99 \) +swap -compose divide -composite -negate -threshold 25% -negate -morphology erode diamond:1 result.png

从数学公式图像中移除整个背景

英文:

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

从数学公式图像中移除整个背景

huangapple
  • 本文由 发表于 2023年7月20日 20:32:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76729925.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定