quran / ayah-detection

scripts to detect ayah markers from quran images
95 stars 41 forks source link

Need instruction on find_lines function #4

Closed ahsanaasim closed 4 years ago

ahsanaasim commented 5 years ago

Assalamu Alaikum,

I am trying to generate metadata for Quran images. But for getting lines, I am confused about the parameters I need to pass. Can you please tell me how do i calculated max pixels and mode?

Documentation says:

there are 3 numbers you'll find configured in the main - line height (approximate height of each line), max pixels (a threshold - how many pixels in a line make the line a quran line vs a line of tashkeel between two lines), and mode (0 or 1 - i think this is used for how to handle the very first line - pass 0 for most cases).

If you could explain with an image, that would be appreciated. Better if you could explain using the following image. Thanks

006

ahmedre commented 5 years ago

wa3laikum alsalam, sorry for the delayed reply. setting those values goes in the __main__ - but i don't think this image will work with the script due to the borders (which there is no support for yet). walsalam 3alaikum.

ahmedre commented 4 years ago

kind of late but i just had to deal with a case like this - mogrify, which is part of imagemagick - is your friend for removing these borders - sample usage:

mogrify -crop 1352x2170+356+282 page003.png

in this case, we are saying "i want an output image that's 1352x2170" - "start that image from position 356x282" - by computing the values of this for your page you can get the image without borders in sha' Allah.

please reopen if you still need help with this. jazakumAllah khairan.