Git Product home page Git Product logo

kumiko's Introduction

Introduction

Kumiko mascot by Cthulhulumaid

Kumiko mascot by Hurluberlue, CC-BY-SA 4.0

Kumiko, the Comics Cutter is a set of tools to compute useful information about comic book pages, panels, and more. Its main strength is to find out the locations of panels within a comic's page (image file). Kumiko can also compile information about panels for all pages in a comic book, and present it as one piece of data (JSON-formatted object).

Kumiko makes use of the great (freely licensed) opencv library, which provides image processing algorithms of all sorts. Mainly, the contour detection algorithm is used to detect panels within an image.

Demo

TL;WR Too Long; Won't Read the whole doc?

A live demo is available here, where you can try Kumiko out and cut your own comic pages into panels.

Philosophy

Kumiko aims at being a functional library to extract information from comic pages / books. The goal is to provide a set of tools that is usable beforehand, to extract all needed information.

External programs can later use the generated information for different purposes: panel-by-panel viewing, actual splitting of an image down into panels, etc.

Panel-by-panel comic reading

Being able to jump from one panel to the next was the original idea behind Kumiko.

xkcd #208

xkcd by Randall Munroe, #208, CC BY-NC 2.5

Comic viewers usually imply a very common page-by-page reading paradigm. You read a page, possibly zooming on it to be able to read speech bubbles, then click, tap, press a key or swipe to the next page.

With knowledge about panels locations, we can imagine a comic reader that also offers panel-by-panel reading. This is especially interesting for small screens, on which you probably can't read the texts if a whole page is displayed.

Just run kumiko -i /path/to/comicpage.jpg -b firefox on your comicpage.jpg file, and read it panel-by-panel in your browser!

Requirements

apt-get install python3-opencv will install the only necessary library needed: opencv.

This should do the trick for Debian distros and derivatives (Ubuntu, Linux Mint...). If you successfully use Kumiko on any other platform, please let us know!

Usage & Testing

See the usage doc for details on how to use the Kumiko tools.

Also check the testing doc if you want to test modified versions of the code.

Numbering

The numbering is left-to-right, or right-to-left if requested.

Here is an example of how Kumiko is going to number panels by default (numbers and red lines not in the original picture).

Pepper&Carrot

Pepper & Carott by David Revoy, episode 2, CC BY 4.0

Contributing

Feature requests and PR are welcome!

Kumiko python code if formatted with yapf. Config file is committed here.

To format all your code, simply run:

yapf3 --recursive --in-place .

Short- and longer-term features (roadmap)

Kumiko library

  • detect panels on a growing range of comic page layouts

    • detect non-framed panels (without clear boundaries/borders)
    • separate intertwined panels
  • be able to detect panel contours on pages with non-white, non-black background done in v1.5

Back-office (validation / edition tool)

Let's face it: we probably can't ensure that Kumiko can perfectly find out the panels in any image. There is a huge diversity of panel boundaries, layouts and whatnot.

This is why there could be some kind of back-office / editing tool that lets a human editor:

  • validate pages
  • add, delete, move or resize incorrect panels
  • report bugs
  • ...

Such a tool would edit the JSON file representing a comic book information, for later use by other programs relying on it.

kumiko's People

Contributors

njean42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kumiko's Issues

Contact.

Hey.

I've found your repo and I'm working on something very similar (also working on bubbles, panel order/flow, face detection, character identification, association of character and bubbles, etc).
I wanted to reach out because I'm curious to learn why you were working on this, and I'd like to know if you're still working on this, and if you'd like to cooperate or discuss possible solutions etc.

Apologies if I'm disturbing you.

[email protected]

Cheers.

Excellent!

I would like to use your excellent tool to create on online comic library based on your demo front end (extending it of course).
Is this code also shared ?
Thanks a lot!

Batch process fails

Hello,
I am trying the batch process now, and it raises an error:

 /home/maxunger/ComicToVideo/kumiko/kumiko -i /var/www/ilurn.com/wp-content/uploads/comics_adventures/lesecretdelalicorne/ > ./lesecretdelalicorne.json
Traceback (most recent call last):
  File "/home/maxunger/ComicToVideo/kumiko/kumiko", line 27, in <module>
    info = k.parse_dir(file_or_folder)
  File "/home/maxunger/ComicToVideo/kumiko/kumikolib.py", line 39, in parse_dir
    return self.parse_images(filenames)
  File "/home/maxunger/ComicToVideo/kumiko/kumikolib.py", line 45, in parse_images
    infos.append(self.parse_image(filename))
  File "/home/maxunger/ComicToVideo/kumiko/kumikolib.py", line 53, in parse_image
    size = list(img.shape[:2])
AttributeError: 'NoneType' object has no attribute 'shape'

Can you please help ?

Can't figure out how to use kumiko

I am terribly sorry if I am simply misunderstanding something, but I can't seem to launch/use kumiko in command line at all. I open command line in the folder with kumiko in it, but any command, like kumiko --help, only produces:
"'kumiko' is not recognized as an internal or external command, operable program or batch file."
I've tried on Windows and in WSL, but the issue is the same. I am probably missing something fundamental, seeing as it works on many machines. I would appreciate any help

kumiko takes a couple of minutes to process some pages

Hi! Sometimes when the image is too big and sharp kumiko takes more than a minute to process a single page (instead of a second). Apparently this can be fixed with applying GaussianBlur or resizing the page in question. For example, by adding a line to the kumikolib.py file:

	def parse_image(self,filename,url=None):
		self.img = cv.imread(filename)
+		self.img = cv.GaussianBlur(self.img,(5,5),0)

The solution is from here

Run kumiko from python script for local files

Hello. I'm trying to execute Kumiko in the Python script on some saved manga images stored on my PC. I tried to follow one of the previous issues by downloading lib folder and kumikolib and running:
from kumikolib import Kumiko k= Kumiko() info = k.parse_url_list(["path to the image"]) panels = info[0]['panels']

but info turned out to be None.
What am I doing wrong? Is there even a way to run Kumiko like this?

Installation help

I'd really like to test out the software, but pip install kumiko doesn't work on my end.

ERROR: Could not find a version that satisfies the requirement kumiko
ERROR: No matching distribution found for kumiko

What could I do to make this work and can kumiko deal with .cbz/cbr files?

ZeroDivisionError

Kumiko throws a ZeroDivisionError when running the algorithm on this image as input. Resolution matters when creating this bug, so this image may not throw an error because of the compression while uploading it. If that's the case I can work with you to get the image to you at the correct resolution.

189_fb517284c29c2a3aef0699a1ad2c6db8

Here is an image of the error logging in the terminal. I've spent some time poking around, but didn't really get anywhere as I don't know python too well.

image

For OpenCV 3.2 or higher version usage

kumikolib.py
change

contours, hierarchy = cv.findContours(thresh, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)

to
_ , contours, hierarchy = cv.findContours(thresh, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)

OpenCV docs

Problem of override default `__eq__` in Panel

	def __eq__(self, other):
		return all(
			[
				abs(self.x - other.x) < self.wt(),
				abs(self.y - other.y) < self.ht(),
				abs(self.r - other.r) < self.wt(),
				abs(self.b - other.b) < self.ht(),
			]
		)

Override __eq__ of Panel cause problem. Assume panel_a is __eq__ to panel_b and panel_b is __eq__ to panel_c, but it is may not true that panel_a is __eq__ to panel_c.
If panel_a, panel_b, panel_c are in panels array(order a b c) and we remove it with.order panel_b, panel_c, panel_a, then panel_a, panel_b will be remove in order, and error will occur when try to remove pane_a because panel_c is left in panels array. This may happens in merge_panes in page.py

Maybe we should avoid override default __eq__ (lt) etc and use explicit func with similar top_left etc

Extract image files of panels

Would be a nice feature if you could extract png's or jpg's of the individual panels for additional processing such as image to text.

Parameter tuning

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.