|Pedro Sá Couto 6f942b01e0 folder||1 year ago|
|.DS_Store||1 year ago|
|bounding_box.py||1 year ago|
|change_res.sh||1 year ago|
|chmod.sh||1 year ago|
|delete_and_start_over.sh||1 year ago|
|merge_files.sh||1 year ago|
|mirror_crop.py||1 year ago|
|readme.md||1 year ago|
|remove.sh||1 year ago|
|rename_scans.sh||1 year ago|
|rotation.py||1 year ago|
|tesseract_ocr.py||1 year ago|
|workshop_stream.sh||1 year ago|
This set of scripts was written for the Text Laundrette workshop. The workshop takes place in the Publication Station, WDkA building.
It is a workflow to turn the pictures from the DIY Book Scanner into a final OCRed PDF.
We will use a home-made, DIY book scanner, and open-source software to scan, process, and add digital features to printed texts brought by the participants to the workshop. Ultimately, we will include them in the “bootleg library”, a shadow library accessible over a local network.
Shadow libraries operate outside of legal copyright frameworks, in response to decreased open access to knowledge. This workshop aims to extend our research on libraries, their sociability, and methods by which we can add provenance to texts included in public or private, legal or extra-legal collections.
Participants should bring: a printed text, which they’d like to digitize and share.
You’ll need the command-line tools for Xcode installed.
After, install Homebrew.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run the following command once you’re done to ensure Homebrew is installed and working properly:
sudo apt-get install python3 python3-pip imagemagick poppler-utils
brew install python3 python3-pip imagemagick poppler-utils
sudo pip3 install pdf2image Pillow opencv-python pytesseract
Add your pictures from the book scanner to the folder "/scans"
Make all the files executable.
sudo chmod 777 merge_scans.sh workshop_stream.sh rename_scans.sh change_res.sh delete_and_start_over.sh
In case you want to skip any of the scripts just comment out in the shell code, workshop_stream.sh.
ImageMagick comes with very low limits:
change /etc/ImageMagick-6/policy.xml to more sensible defaults:
In terminal run ./workshop_stream.sh
The workflow follows these scripts, by successive order:
mkdir split mkdir rotated mkdir ocred mkdir bounding_box mkdir cropped
All the scans will be renamed
Change resolution of the scans so that it is lighter to process
The book scanner takes pictures of the pdfs, this scrip iterates through the odd and even pages rotating them to their original position.
The pages are now in their original position, but they have a bounding box. This script iterates through them and crops the highest contrast area found.
The pages are now cropped, but the mirror may still be visible in the edge. This happens if the cameras are not adjusted properly. I commented it out because if the cameras are positioned correctly there is no need for this step.
In this part we OCR the jpg files, turning these into PDFs.
The OCRed pages are now joined into their final PDF, your book is ready :)
Just run delete_and_start_over.sh and start over
The package is available as open source under the terms of the MIT License.