njean42/kumiko

Parameter tuning

Closed this issue ยท 4 comments

I notice that when cutting certain xkcd comics, the cutting is not perfect, which is expected for a general-purpose tool. For example, This xkcd creates a panel that starts at the left edge and goes halfway into the second panel
as so. Which parameters should I tune in order to avoid these? Contour detection? panel.split?

Another example finds this
this as a panel

You're completely right.

Currently Kumiko can only detect panels that are surrounded by a frame. Both examples - and numerous other xkcds - have one of those panels with no boundary.
In classical/colourful comics, this is mitigated by each panel having some background color(s) that serves as boundary (in the contour detection Kumiko performs).

But in xkcd, non-framed panels suffer very erratic detection: many small bits of the inner drawing get detected as panels. Then Kumiko tries to expand those panels (and the left one you mention), making the situation even worse (=> the left panel goes half-way through the second one).
You can actually see the detected panels on the demo I just relaunched (after computation, type p to view full page then d for debug - those shortcuts are listed in the menu, type m ๐Ÿ˜„)

This is something I want to address, probably by grouping smaller panels and checking if they can make a larger one, when merged together.

I added a 1 pixel padding to the comic (cv2.copyMakeBorder) and it seems to be working better:
image

This could be an option for Kumiko, if you remove the padding after, but it's kind of hacky so maybe not. Thanks for your help, the demo makes verification of this method way easier.

Happy to hear that the demo proves useful! โœŒ๏ธ
Interesting, it crossed my mind that the absence of padding could be an issue, but really thought it was something else in this case.
It is a bit hacky but definitely an option to explore.

Hi back @kevinlinxc
So I coded this "grouping of small panels", to detect text and drawings outside of frames; just pushed it.
The demo is also updated, you can check that it now works much better for xkcds! (although not perfectly for some)
I tried the last dozen of them ๐Ÿ˜‰
(Edit 1: I didn't yet take the 1px-margin approach)
(Edit 2: The second example you provided still has a major issue though, it seems - will work on it as an example)