This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
Here are some of the input images:
And here are the results:
Assuming it's saved as a file named whiteboardClean.sh
, the command is ./whiteboardClean.sh {name of input file} {name of file to output to}
.
Here's an example:
./whiteboardClean.sh example1.jpg output1.png
I was doing a lot work with whiteboards and I'd been taking pictures of them to document what had been written. I wanted a more clean version of the pictures though, something that captured the essence of what a whiteboard image showed.
Eventually I found this excellent guide to cleaning up whiteboard photos using GIMP. However, I found I wanted more automation. So, I spent a few hours yesterday figuring out how to do the same thing using ImageMagick from the command line and made this script.
Hi. Blatant ask for assistance - is there any way to get a similar script to run in python (actually pythonista on an ipad)? My students (high school) send me photographs of their responses to questions. I then save these on my iPad and use a script? in the 'workflow' app which rotates the images (if necessary) and converts them to pdf, which I then open in another app (notability) so that I can annotate and then email them back to the students. I would like to use the above script as part of my workflow script to automate everything. My thoughts are to use pythonista (which 'workflow' can talk to) to run something similar to the script above to clean up the students photographs. Sorry for the long-winded ask for help (non-programmer here).