Scripts used to process a book scanned through the DIY Book Scanner.
您最多能選擇 25 個主題 主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。
 
 
Pedro Sá Couto 6f942b01e0 folder 4 年前
.DS_Store folder 4 年前
bounding_box.py working 4 年前
change_res.sh working 4 年前
chmod.sh Needs to be tested 4 年前
delete_and_start_over.sh working 4 年前
merge_files.sh Should work, needs heavy testing 4 年前
mirror_crop.py working 4 年前
readme.md working 4 年前
remove.sh working 4 年前
rename_scans.sh working 4 年前
rotation.py working 4 年前
tesseract_ocr.py working 4 年前
workshop_stream.sh working 4 年前

readme.md

DIY Book Scanner Workflow

Getting started

This set of scripts was written for the Text Laundrette workshop. The workshop takes place in the Publication Station, WDkA building.
Rotterdam, 03-02-2020
It is a workflow to turn the pictures from the DIY Book Scanner into a final OCRed PDF.

About the Workshop

DESCRIPTION

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.



##Dependencies ###Brew (MAC) or apt-get (LINUX)

You’ll need the command-line tools for Xcode installed.

xcode-select --install

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:

brew doctor
sudo apt-get install python3 python3-pip imagemagick poppler-utils
brew install python3 python3-pip imagemagick poppler-utils

###PIP3
sudo pip3 install pdf2image Pillow opencv-python pytesseract

##How to use

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.

###Increase Imagemagick resources

nano /etc/ImageMagic-6/policy.xml

ImageMagick comes with very low limits:

Resource limits:
Width: 16KP
Height: 16KP
Area: 128MP
Memory: 256MiB
Map: 512MiB
Disk: 1GiB
File: 768
Thread: 4
Throttle: 0
Time: unlimited

change /etc/ImageMagick-6/policy.xml to more sensible defaults:

Resource limits:
Width: 128KP
Height: 128KP
Area: 1.0737GP
Memory: 2GiB
Map: 4GiB
Disk: 8GiB
File: 768
Thread: 4
Throttle: 0
Time: unlimited

###RUN

In terminal run ./workshop_stream.sh

Wait :)



##Aditional information The workflow follows these scripts, by successive order:

###Create 5 directories

mkdir split
mkdir rotated
mkdir ocred
mkdir bounding_box
mkdir cropped

###Merge the files in the directory scans

All the scans will be renamed

```bash ./rename_scans.sh ```

###Burst the pdf in scans

Change resolution of the scans so that it is lighter to process

```bash ./change_res.sh ```

###Rotate the pdfs

The book scanner takes pictures of the pdfs, this scrip iterates through the odd and even pages rotating them to their original position.

```bash python3 rotation.py ```

###Crop the bounding boxes

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.

```bash python3 bounding_box.py ```

###Crop the mirror

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.

```bash python3 mirror_crop.py ```

###OCR

In this part we OCR the jpg files, turning these into PDFs.

```bash python3 tesseract_ocr.py ```

###Merge all the files and create the pdf

The OCRed pages are now joined into their final PDF, your book is ready :)

```bash ./merge_files.sh ```

##START OVER

Just run delete_and_start_over.sh and start over

```bash ./delete_and_start_over.sh ```

## License The package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).