View Single Post
Old 07-14-2009, 12:02 PM   #5
frediz began at the beginning.
Posts: 14
Karma: 10
Join Date: Mar 2009
Device: prs 505
Originally Posted by Kostas View Post
Thanks a lot Frediz,

Actually I've been palying quite a moment with your fantastic tool!
Great job!
It does amazing things so quickly!!
(btw, I doubt if such a tool could ever get a gui...)

Two remarks:
1. It seems that your initial instructions about the mhs filter (the most impressive feature which allows to split horizontally the comic strip) could be outdated (maybe a previous version?). After severals tests, I didn't find the way to pass parameters to mhs concerning the number of pictures in which the original must be split.
But I found that you can set the sensitivity threshold to autosplit the picture (probably based on white balance).

This is the instruction that is given with
cpu -f mhs=help

Usage :

Description :
Splits image horizontally at blank lines.

m : min white : all pixels of line should have higher value to be a split line
s : min size region : the splitted region won't be less than that (Default=140)
I get good reults in my tests with a value of 15-30. So, it gives something like this:
cpu -o out -f mhs=20 pic1.jpg
One has to play with the value of the parameter to optimize the result, although some failures needing fine tuning are unavoidable.
True... Perfect splitting is intelligence based I fear.

Btw m=20 ? you should have dark pics ?!

As you guessed, m parameter is a threshold.
Colored pictured are converted to gray levels from 0 to 255.
0 being black, and 255 is white
So for the line to be considered as ok i.e. we can split the pic at this line, all
the pixels should have a value greater than m.
Actually, splitting in a fixed number of subpictures the current picture is doable.
But as for threshold, in my the examples I tested, the pages are not always splitable
the same way. And the number of subpic being not always the same across the pages,
it had (at first sight) the same pb as for threshold. A parameter could be a nb of max images to be splitted into. Could give good results ?
It will just be slower, because the simple algorithm would be to test different threshold.
I thought of it too but didn't implement it... not hard at first sight.

I don't know if you played with s options. This will force splitting not cut sub images with
dimension less than s in this direction.
To be clear, with default s=140 : the height of images produced by mhs won't be less than 140 pixels.

Checking the code, there is hidden features
mhs = min based horizontal splitting
I see some more filters :
- ahs : average based horizontal splitting
- avs : average based vertical splitting

So splitting can be done also based on an average threshold. And vertically too.
But average based results were not satisfying to me. Min is simple and gave good results. But all of this, once again, was just feelings for my own needs. Some may
have other and be interested in this.
Anyway I can add a "mvs", it wouldn't be hard I think.

Originally Posted by Kostas View Post
If you want a rotated, greyscale, autocropped, horizontally autosplitted comic, it goes like this:
cpu -o out -f r,g,a,mhs=20 pic1.jpg
2. My only small deception is the -f s (autosplit) filter. Unlike mhs for horizontal splitting, it splits vertically in equal parts, with no autodetection logic. If one wants to have "intelligent" vertical autosplitting, the solution is to aplly mhs after a rotation and to do the counter rotation back after...
yes "splitpages" is a dummy in-the-middle cut.
mvs equivalent would be something ok for you ?

Originally Posted by Kostas View Post
Anyway, it's a Great Tool!


Last edited by frediz; 07-14-2009 at 12:08 PM.
frediz is offline   Reply With Quote