University Chalkboard

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
Hacke92
Posts: 4
Joined: 2012-09-13T05:09:40-07:00
Authentication code: 67789

University Chalkboard

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: University Chalkboard

Post 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
Hacke92
Posts: 4
Joined: 2012-09-13T05:09:40-07:00
Authentication code: 67789

Re: University Chalkboard

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: University Chalkboard

Post 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/
Hacke92
Posts: 4
Joined: 2012-09-13T05:09:40-07:00
Authentication code: 67789

Re: University Chalkboard

Post 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..
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: University Chalkboard

Post by magick »

Try -lat 3x3. Note there are two values.
Hacke92
Posts: 4
Joined: 2012-09-13T05:09:40-07:00
Authentication code: 67789

Re: University Chalkboard

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: University Chalkboard

Post 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.
Post Reply