Page 1 of 1

University Chalkboard

Posted: 2012-09-13T05:35:54-07:00
by Hacke92
Hi
I'm a student and i'm working on a project to "digitalize" the text written by the teacher on the chalkboard.
The images are captured with as good lighting conditions as possible, and a fairly good render of what i am trying to create looks like this:
Original:
Image

And with a command line like:

Code: Select all

 -type Grayscale -brightness-contrast __x__ -negate -posterize 2
The result will be:
Image

The above example is just fine with me since the goal is to get only black and white with the text clearly visible

The problem is when i only get pictures like these:
Shadow cavering parts of the text
Image

A partly wet board
Image

When i do the same effect to these pictures I have a hard time extracting the text in the darker areas and i wonder if the is any command that might help me with this?

Thanks in advance!

Re: University Chalkboard

Posted: 2012-09-13T09:25:06-07:00
by fmw42
try using -lat

see http://www.imagemagick.org/script/comma ... ns.php#lat

You may also want to look at my unix bash scripts, whiteboard and textcleaner. Though I have not tried them on colored backgrounds. So you may have to convert to grayscale or desaturate the images and negate them.

see
-colorspace gray
-modulate 100,0,100
-negate

http://www.imagemagick.org/script/comma ... ptions.php


The key to those scripts is using -lat with a size just larger than the text and about 10% or 20% offset. See -lat http://www.imagemagick.org/script/comma ... ns.php#lat

Re: University Chalkboard

Posted: 2012-09-13T10:22:22-07:00
by Hacke92
lat looks very promising! thx!

I was actually looking a lot at your scripts when I started. But since I'm in a windows enviroment I guess i would have to use cygwin. The software I'm building is meant to be portable so I tried to make it work with Cygwin portable, but without any luck.. Maybe you have some advice to share?

Could you please explain "just larger than the text"?
fmw42 wrote:try using -lat

see http://www.imagemagick.org/script/comma ... ns.php#lat

You may also want to look at my unix bash scripts, whiteboard and textcleaner. Though I have not tried them on colored backgrounds. So you may have to convert to grayscale or desaturate the images and negate them.

see
-colorspace gray
-modulate 100,0,100
-negate

http://www.imagemagick.org/script/comma ... ptions.php


The key to those scripts is using -lat with a size just larger than the text and about 10% or 20% offset. See -lat http://www.imagemagick.org/script/comma ... ns.php#lat

Re: University Chalkboard

Posted: 2012-09-13T11:10:54-07:00
by fmw42
Could you please explain "just larger than the text"?
Make the widthxheight value of -lat be just a little larger than the dimensions of any character in the text.

Sorry I do not program windows. But you can look here for some help. http://www.imagemagick.org/Usage/windows/

Re: University Chalkboard

Posted: 2012-09-14T09:46:11-07:00
by Hacke92
fmw42 wrote:
Could you please explain "just larger than the text"?
Make the widthxheight value of -lat be just a little larger than the dimensions of any character in the text.
I I've tried using -lat but I keep getting "memory allocation failed".
Read on the forum that adding "-limit memory 0 -limit disk 0 -limit area 0 -limit map 0" should help, but sadly it doesn't..

Re: University Chalkboard

Posted: 2012-09-14T10:07:08-07:00
by magick
Try -lat 3x3. Note there are two values.

Re: University Chalkboard

Posted: 2012-09-14T11:45:18-07:00
by Hacke92
magick wrote:Try -lat 3x3. Note there are two values.
That did the trick!
This is what i get:
HighRes: https://dl.dropbox.com/u/24580186/IMG_5146Edit.jpg
Image

It does a great job job with finding the letters, but I don't really know how to deal with the empty parts of the board?

Re: University Chalkboard

Posted: 2012-09-14T12:21:54-07:00
by fmw42
You need to make the filter size larger than any one character. try more like -lat 20x20. It will take longer, but you will get a better result. If needed make the size even larger. Play with the size to use the smallest value that works well.