File: hello_world.py

package info (click to toggle)
gamera 3.4.1%2Bsvn1423-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 22,292 kB
  • ctags: 25,015
  • sloc: xml: 122,324; ansic: 50,812; cpp: 50,489; python: 34,987; makefile: 119; sh: 101
file content (17 lines) | stat: -rw-r--r-- 464 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sys

from gamera.core import *
init_gamera()

# Load filename specified on the command line.
# sys.argv is the Pythonic way to access commandline arguments.
# load_image is a Gamera function to load a TIFF or PNG file.
image = load_image(sys.argv[-1])

# The variable 'image' now is a reference to the image

# Convert the image to onebit using `otsu_threshold`
onebit = image.otsu_threshold()

# Save the result to a PNG file
onebit.save_PNG("output.png")