Code Monkey home page Code Monkey logo

scanned-image-processing's Introduction

scanned-image-processing

Python scripts for processing scanned rocks

The idea:

  • User clicks photo of rock to crop and add scale bar

To run: python rock-crop.py 'path/to/directory/of/photos'

Requirements:

  • Python packages:
    • sys, os, matplotlib, numpy, Python Image Library (PIL)
  • Other:
    • All photos you want to process should be in one directory.
    • All final (cropped and scaled) photos will be save in a sub-directory called 'cropped-photos'. I think you should make this directory ahead of time, but you might not have to.
    • Fonts in PIL are handled strangely and won't be scalable by default. There's a good chance what I have hard-coded is Mac-specific (or possibly even specific to my machine). If you need to change the path, edit this line:
      font_path = "/Library/Fonts/MyriadPro-Regular.otf"
      in the method add_scalebar in rock-crop.py.

Example: python rock-crop.py 'test-folder'
will allow you to crop and add scales to three photos of Neoproterozoic rocks in South Australia.

Sequence of events:
Note: you never click more than two (2) points on each pop-up window

  1. The active photo will appear in a pop-up window
  2. You click the top left and bottom right corners of the area in the photo you would like to keep (make sure your scale bar is in this cropped area!!)
  3. The photo is then cropped and will reappear (cropped).
  4. You click the left and right extents of the scale bar (e.g. click on "5" and "6" cm markings on a ruler to add a 1 cm scale bar.
  5. Then, click the top left and lower right corners again to make your final crop!
  6. Finally, click the spot where you want the left extent of the scale bar to appear. The writing will go under the scale bar.

The final photo will be saved in an output folder called cropped-photos in the same directory as the input photos.

scanned-image-processing's People

Contributors

juliawilcots avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.