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

Implementing resolution reduction #690

Open Sahil-5111998 opened 1 year ago

Sahil-5111998 commented 1 year ago

Hi,

I am trying to implement resolution reduction on some binary images, the same resolution reduction that is implemented in the JBIG (I think JBIG2 does the same). I am getting stuck in its implementation and I hope that you can help me here.

In the JBIG docs they have said that JBIG uses the resolution reduction table to perform the resolution reduction, however I am not able to make out how that table is being used.

In the implementation, they have told that the value of a low-resolution pixel depends upon 9 high and 3 low-level pixels. the values of 0-7 high-level pixels act as an index to the resolution reduction table. However, I am not able to understand how to get the value of low-resolution pixels from that table. i.e., by raster scan I am able to get the value of 7 high-level pixels and then how would I make out the low-resolution pixel value?

I know it is a very basic question but I was not able to find any documentation that would tell me how to use that table. All the documentation that I have come across has only told to use the table but never mentioned how.

Please do help me if you know how to use the table it will be greatly appreciated.

Thanks, Sahil

DanBloomberg commented 1 year ago

Sorry, I don't know anything about jbig scaling tables, and did not find out by a simple google search.

Leptonica has many functions for downscaling, and you should in particular look at those in scale1.c. If you wish, please furnish links to the jbig scaling functions that you mention.