Computer-assisted image straightening and cropping
MobyCAIRO stands for Computer-Assisted Image ROtation. It is designed to assist a user in the common, tedious tasks of rotating and cropping images.
The ‘Moby’ portion of the name is due to its original purpose being to help alleviate the tedium of straightening cover art scans for submission to the MobyGames online video game database.
When run, the MobyCAIRO GUI will prompt the user to load an image for processing. After loading, GUI transitions to the Rotate tab. This tab attempts to automatically detect the most likely rotation angle that will make the image straight, correcting for skew introduced in scanning the image. This is computed by detecting groups of straight lines in the image. The user can select from a number of angles and then make fine adjustments in 1, 0.1, or 0.01 degree increments:
The rotation tab also allows toggling the image view to reveal the edges that MobyCAIRO used to find the straight ones.
After straightening the image using the Rotate tab, move to the Crop tab. By default, MobyCAIRO will detect circles as crop candidates, and allow the user to choose among them using a list box where the circles are listed in descending order by size. Keyboard controls allow fine controls to adjust the circle:
For selecting a rectangular region to crop, simply use the mouse to select the region:
Once the image is rotated and cropped, move on to the Save tab which prompts the user for a filename for saving the image.
See the final straightenend and cropped scans for this CD-ROM and related jewel case artifacts at the Internet Archive.
MobyCAIRO is a tool that runs on a user’s local machine (as opposed to running in a web browser). There are 2 options for getting MobyCAIRO:
virtualenv -p python3 venv
venv\Scripts\activate.bat
source venv/bin/activate
pip install -r requirements.txt
In order to run the tool on Windows, the easiest approach is to download the release EXE and double-click it from Windows Explorer.
On other platforms, establish and activate the Python environment as described in the previous step, and then execute: python MobyCAIRO.py
MobyCAIRO uses the OpenCV computer vision library. MobyCAIRO can read any format that the underlying OpenCV library supports, which includes:
(source: https://docs.opencv.org/master/d4/da8/group__imgcodecs.html)
Note that there are a few caveats to the above support, as well as some more supported format. See the OpenCV documentation for specifics.
These are the technologies used to build this tool:
You can read more about the program’s development from this blog post by the author.
Thanks to The e-Reader Preservation Project for the cool MobyCAIRO logo.