DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.74k stars 387 forks source link

May I ask which interface is used to implement the effect shown in the following figure? #691

Open jueqing1015 opened 1 year ago

jueqing1015 commented 1 year ago

I want to remove the background color of the image in bulk to make it white, but I found that the CleanBackgroundToWhite interface will remove some of the colored parts from the image during cleaning. 微信截图_20230408223346

DanBloomberg commented 1 year ago

See prog/adaptmap_reg.c.

You'll see pixim, which is a mask over the image part. For the image pat that has the painting, we don't clean to white, just do a TRC using pixGammaTRCMasked().

jueqing1015 commented 1 year ago

@DanBloomberg I don't know why I couldn't produce the correct effect by referring to the code in the example. Could you please use the following image to handle it? test

DanBloomberg commented 1 year ago

You can do this. Identify the bounding box of the image. (It was hardcoded in adaptmap_reg.c ) Then use the same approach.