From 8f3a77ceb597b694adadd5009eef2b13598bc0b6 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Thu, 29 Dec 2011 17:00:16 +0100 Subject: [PATCH] Prepares to packaging Creates all necessary files. Instructions are taken from here : http://guide.python-distribute.org/creation.html Some steps are still to be performed. Reported-by: Julien Lengrand-Lambert Signed-off-by: Julien Lengrand-Lambert --- CHANGES.txt | 1 + COPYING => LICENSE.txt | 0 MANIFEST.in | 2 + README.markdown | 11 +- README.txt | 75 ++++++ build.xml | 6 +- doc/examples.html | 5 +- doc/tippy.html | 5 +- doc/tippy.statistics.html | 81 +++++++ doc/tippy.tests.html | 3 +- doc/tippy.tests.test_statistics.html | 344 +++++++++++++++++++++++++++ setup.py | 17 ++ 12 files changed, 536 insertions(+), 14 deletions(-) create mode 100644 CHANGES.txt rename COPYING => LICENSE.txt (100%) create mode 100644 MANIFEST.in create mode 100644 README.txt create mode 100644 doc/tippy.statistics.html create mode 100644 doc/tippy.tests.test_statistics.html create mode 100644 setup.py diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..4a1adb0 --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1 @@ +v0.1.0, 12-29-2011 -- Initial release. \ No newline at end of file diff --git a/COPYING b/LICENSE.txt similarity index 100% rename from COPYING rename to LICENSE.txt diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d38a245 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include *.txt +recursive-include docs *.html \ No newline at end of file diff --git a/README.markdown b/README.markdown index 8b1d9b7..3e80549 100644 --- a/README.markdown +++ b/README.markdown @@ -52,12 +52,12 @@ Please note that the library is in current development, and is only available as To use Tippy, you will need the last OpenCV version with Python bindings. A descriptive tutorial for Linux systems can be found [here](http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian). -Being in the very beginning of its development, Tippy yet is not available in packaged version. To use it, you will need to downlad the source file and include them in your application. +Being in the very beginning of its development, Tippy yet is not available in packaged version. To use it, you will need to download the source file and include them in your application. The action is pretty straightforward though: - Download the tippy folder of the Tippy project - Place it in your working directory. -- import parts of the library as you wish by using 'import file' in your python code. +- import parts of the library as you wish by using 'import file' in your Python code. ## Hints and Usage @@ -67,13 +67,13 @@ In addition, tests should be carried out so that the code contain as few hidden Finally, functions should be heavily documented to help users dig in without encounter language problems. -I am currently thinking about generating a more complete and redable documentation, such as html output. It should come soon. +I am currently thinking about generating a more complete and readable documentation, such as html output. It should come soon. ## Copyright Copyright © 2011 Julien Lengrand-Lambert -Files are licensed under the under the BSD License. See the file COPYING for details. +Files are licensed under the under the BSD License. See the file LICENCE.txt for details. You are free to use it as you wish, but I would love if you let me know ^^ Image: Paul Martin Eldridge / FreeDigitalPhotos.net @@ -83,5 +83,4 @@ Image: Paul Martin Eldridge / FreeDigitalPhotos.net I would enjoy having feedback if you use this theme. Feel free to mail me for any comment or request. -You can contact me at julien at lengrand dot fr, or on my [current website](http://www.lengrand.fr) - +You can contact me at julien@lengrand.fr, or on my [current website](http://www.lengrand.fr) \ No newline at end of file diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..cafaaad --- /dev/null +++ b/README.txt @@ -0,0 +1,75 @@ +=========== +Tippy : another Toolbox for Image Processing in PYthon +=========== + + +Tippy is a set of functions and methods designed to reduce as much as possible the code needed to deploy an or algorithm. It is based on the famous library and its Python bindings. + +OpenCV is one of the most famous Computer Vision library in the world, and surely the most famous one in the open-source one. It provides more than 500 functions, from basic one to complete and complex methods. +It is mainly implemented in C code, but now supports lots of languages and platforms (C++, java, iphone and android, ...). + +This project aims at magnifying the power of OpenCV in using the power of Python. The idea is to get as much results as possible with as little code as possible. +In this way, this code will keep using well known OpenCV structures (such as cvMat or IplImage) while simplifying its use. + + +Let's imagine we have an RGB image, and we want to display the histogram of its blue channel values. +Typical usage often looks like this:: + + #!/usr/bin/env python + import cv + from tippy import statistics as st + from tippy import display_operations as do + + # test with 8 bits color image + img_name = "tippy/data/tippy.jpg" + img = cv.LoadImage(img_name, cv.CV_LOAD_IMAGE_COLOR) + hist = st.Histogram(img) + + imgs = hist.to_images() # list of Red, Green, Blue channels + do.display_single_image(imgs[2], "Blue channel histogram of the tippy image") + + +**Please note that the library is in current development, and is only available as source code for now. This explains why the bin folder is still empty.** + + +A Installation +========= + +To use Tippy, you will need the last OpenCV version with Python bindings. A descriptive tutorial for Linux systems can be found here :http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian. + +Being in the very beginning of its development, Tippy yet is not available in packaged version. To use it, you will need to download the source file and include them in your application. + +The action is pretty straightforward though: +* Download the tippy folder of the Tippy project +* Place it in your working directory. +* import parts of the library as you wish by using 'import file' in your Python code. + +B Hints and Usage +========= + +Important points of Tippy are documentation and examples. +An example will be create for every single function present in the Tippy package, so that it can easily be used by everyone. +In addition, tests should be carried out so that the code contain as few hidden bugs as possible. + +Finally, functions should be heavily documented to help users dig in without encounter language problems. + +I am currently thinking about generating a more complete and readable documentation, such as html output. It should come soon. + +C Copyright +========= + +Copyright © 2011 Julien Lengrand-Lambert + +Files are licensed under the under the BSD License. See the file LICENCE.txt for details. +You are free to use it as you wish, but I would love if you let me know ^^ + +Image: Paul Martin Eldridge / FreeDigitalPhotos.net + + +D Contact +========= + +I would enjoy having feedback if you use this theme. +Feel free to mail me for any comment or request. + +You can contact me at julien@lengrand.fr, or on my current website : http://www.lengrand.fr \ No newline at end of file diff --git a/build.xml b/build.xml index 364d277..04a62e9 100644 --- a/build.xml +++ b/build.xml @@ -14,13 +14,13 @@ - + - + - + diff --git a/doc/examples.html b/doc/examples.html index f57724f..fa9d9b9 100644 --- a/doc/examples.html +++ b/doc/examples.html @@ -17,6 +17,7 @@ Package Contents         -
region_growing
-
+
histogram_display
+
region_growing
+
\ No newline at end of file diff --git a/doc/tippy.html b/doc/tippy.html index 2ad44cf..9931557 100644 --- a/doc/tippy.html +++ b/doc/tippy.html @@ -18,8 +18,9 @@        
basic_operations
-
display_operations
+display_operations
segmentations
+statistics
tests (package)
-
+ \ No newline at end of file diff --git a/doc/tippy.statistics.html b/doc/tippy.statistics.html new file mode 100644 index 0000000..211c4fa --- /dev/null +++ b/doc/tippy.statistics.html @@ -0,0 +1,81 @@ + + +Python: module tippy.statistics + + + + +
 
+ 
tippy.statistics
index
/home/jlengrand/git/Tippy/tippy/statistics.py
+

Contains functions related to statistics processing. 

+Created on Dec 11, 2011

+@author: Julien Lengrand-Lambert
+@email: julien@lengrand.fr

+

+ + + + + +
 
+Modules
       
cv
+
sys
+

+ + + + + +
 
+Classes
       
+
Histogram +
+

+ + + + + + + +
 
+class Histogram
   This class is designed to contain an openCV class plus some more information
+to ease further operations.

+NOTE : Supports only 8 bits images for now. 
+More should be added soon.
 
 Methods defined here:
+
__init__(self, img, bin_fact=8L, min_range=0)
+ +
channel_to_image(self, chan, scale_x=3, scale_y=3, y_range=64)
Creates an iplimage displaying histogram results after its computation
+ +
compute_histogram(self, img, bin_fact=8L, min_range=0)
Creates the histogram of the input image

+Returns a Tippy histogram, with one item by channel of input image.
+The number of bins is 2^bin_fact (256 by default)
+min_range is the value of the lowest bin
+max_range is automatically calculated using the input image depth. 
+max_range = (2^img_depth)

+NOTE : Supports only 8 bits images for now. 
+More should be added soon.
+ +
to_images(self, scale_x=3, scale_y=3, y_range=64)
Creates a graphical representation of an histogram.
+Outputs a list of nChannels iplimages, one for each channel of the 
+histogram. 
+The images should have the same depth as the image used to create the 
+histogram.
+ +
to_tables(self)
Transforms an histogram into a list of values.
+This way, it is easier to process for calculations.

+Returns a list of nChannels items.

+NOTE : Supports only 8 bits images for now. 
+More should be added soon.
+ +

+ \ No newline at end of file diff --git a/doc/tippy.tests.html b/doc/tippy.tests.html index 2aa1a2b..5aa4d2f 100644 --- a/doc/tippy.tests.html +++ b/doc/tippy.tests.html @@ -20,5 +20,6 @@
test_basic_operations
test_display_operations
test_segmentation
-
+test_statistics
+ \ No newline at end of file diff --git a/doc/tippy.tests.test_statistics.html b/doc/tippy.tests.test_statistics.html new file mode 100644 index 0000000..bff5530 --- /dev/null +++ b/doc/tippy.tests.test_statistics.html @@ -0,0 +1,344 @@ + + +Python: module tippy.tests.test_statistics + + + + +
 
+ 
tippy.tests.test_statistics
index
/home/jlengrand/git/Tippy/tippy/tests/test_statistics.py
+

Created on Dec 11, 2011

+@author: Julien Lengrand-Lambert
+@email: julien@lengrand.fr

+

+ + + + + +
 
+Modules
       
cv
+
tippy.statistics
+
unittest
+

+ + + + + +
 
+Classes
       
+
unittest.case.TestCase(__builtin__.object) +
+
+
Test +
+
+
+

+ + + + + +
 
+class Test(unittest.case.TestCase)
    
Method resolution order:
+
Test
+
unittest.case.TestCase
+
__builtin__.object
+
+
+Methods defined here:
+
setUp(self)
This method is called before each test
+ +
tearDown(self)
This method is called after each test
+ +
test_channel_to_image(self)
+ +
test_compute_histogram(self)
#--- 
+## TESTS
+ +
test_to_images(self)
+ +
test_to_tables(self)
+ +
+Methods inherited from unittest.case.TestCase:
+
__call__(self, *args, **kwds)
+ +
__eq__(self, other)
+ +
__hash__(self)
+ +
__init__(self, methodName='runTest')
Create an instance of the class that will use the named test
+method when executed. Raises a ValueError if the instance does
+not have a method with the specified name.
+ +
__ne__(self, other)
+ +
__repr__(self)
+ +
__str__(self)
+ +
addCleanup(self, function, *args, **kwargs)
Add a function, with arguments, to be called when the test is
+completed. Functions added are called on a LIFO basis and are
+called after tearDown on test failure or success.

+Cleanup items are called even if setUp fails (unlike tearDown).
+ +
addTypeEqualityFunc(self, typeobj, function)
Add a type specific assertEqual style function to compare a type.

+This method is for use by TestCase subclasses that need to register
+their own type equality functions to provide nicer error messages.

+Args:
+    typeobj: The data type to call this function on when both values
+            are of the same type in assertEqual().
+    function: The callable taking two arguments and an optional
+            msg= argument that raises self.failureException with a
+            useful error message when the two arguments are not equal.
+ +
assertAlmostEqual(self, first, second, places=None, msg=None, delta=None)
Fail if the two objects are unequal as determined by their
+difference rounded to the given number of decimal places
+(default 7) and comparing to zero, or by comparing that the
+between the two objects is more than the given delta.

+Note that decimal places (from zero) are usually not the same
+as significant digits (measured from the most signficant digit).

+If the two objects compare equal then they will automatically
+compare almost equal.
+ +
assertAlmostEquals = assertAlmostEqual(self, first, second, places=None, msg=None, delta=None)
Fail if the two objects are unequal as determined by their
+difference rounded to the given number of decimal places
+(default 7) and comparing to zero, or by comparing that the
+between the two objects is more than the given delta.

+Note that decimal places (from zero) are usually not the same
+as significant digits (measured from the most signficant digit).

+If the two objects compare equal then they will automatically
+compare almost equal.
+ +
assertDictContainsSubset(self, expected, actual, msg=None)
Checks whether actual is a superset of expected.
+ +
assertDictEqual(self, d1, d2, msg=None)
+ +
assertEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
+operator.
+ +
assertEquals = assertEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
+operator.
+ +
assertFalse(self, expr, msg=None)
Check that the expression is false.
+ +
assertGreater(self, a, b, msg=None)
Just like assertTrue(a > b), but with a nicer default message.
+ +
assertGreaterEqual(self, a, b, msg=None)
Just like assertTrue(a >= b), but with a nicer default message.
+ +
assertIn(self, member, container, msg=None)
Just like assertTrue(a in b), but with a nicer default message.
+ +
assertIs(self, expr1, expr2, msg=None)
Just like assertTrue(a is b), but with a nicer default message.
+ +
assertIsInstance(self, obj, cls, msg=None)
Same as assertTrue(isinstance(obj, cls)), with a nicer
+default message.
+ +
assertIsNone(self, obj, msg=None)
Same as assertTrue(obj is None), with a nicer default message.
+ +
assertIsNot(self, expr1, expr2, msg=None)
Just like assertTrue(a is not b), but with a nicer default message.
+ +
assertIsNotNone(self, obj, msg=None)
Included for symmetry with assertIsNone.
+ +
assertItemsEqual(self, expected_seq, actual_seq, msg=None)
An unordered sequence specific comparison. It asserts that
+actual_seq and expected_seq have the same element counts.
+Equivalent to::

+    assertEqual(Counter(iter(actual_seq)),
+                     Counter(iter(expected_seq)))

+Asserts that each element has the same count in both sequences.
+Example:
+    - [0, 1, 1] and [1, 0, 1] compare equal.
+    - [0, 0, 1] and [0, 1] compare unequal.
+ +
assertLess(self, a, b, msg=None)
Just like assertTrue(a < b), but with a nicer default message.
+ +
assertLessEqual(self, a, b, msg=None)
Just like assertTrue(a <= b), but with a nicer default message.
+ +
assertListEqual(self, list1, list2, msg=None)
A list-specific equality assertion.

+Args:
+    list1: The first list to compare.
+    list2: The second list to compare.
+    msg: Optional message to use on failure instead of a list of
+            differences.
+ +
assertMultiLineEqual(self, first, second, msg=None)
Assert that two multi-line strings are equal.
+ +
assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=None)
Fail if the two objects are equal as determined by their
+difference rounded to the given number of decimal places
+(default 7) and comparing to zero, or by comparing that the
+between the two objects is less than the given delta.

+Note that decimal places (from zero) are usually not the same
+as significant digits (measured from the most signficant digit).

+Objects that are equal automatically fail.
+ +
assertNotAlmostEquals = assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=None)
Fail if the two objects are equal as determined by their
+difference rounded to the given number of decimal places
+(default 7) and comparing to zero, or by comparing that the
+between the two objects is less than the given delta.

+Note that decimal places (from zero) are usually not the same
+as significant digits (measured from the most signficant digit).

+Objects that are equal automatically fail.
+ +
assertNotEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
+operator.
+ +
assertNotEquals = assertNotEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
+operator.
+ +
assertNotIn(self, member, container, msg=None)
Just like assertTrue(a not in b), but with a nicer default message.
+ +
assertNotIsInstance(self, obj, cls, msg=None)
Included for symmetry with assertIsInstance.
+ +
assertNotRegexpMatches(self, text, unexpected_regexp, msg=None)
Fail the test if the text matches the regular expression.
+ +
assertRaises(self, excClass, callableObj=None, *args, **kwargs)
Fail unless an exception of class excClass is thrown
+by callableObj when invoked with arguments args and keyword
+arguments kwargs. If a different type of exception is
+thrown, it will not be caught, and the test case will be
+deemed to have suffered an error, exactly as for an
+unexpected exception.

+If called with callableObj omitted or None, will return a
+context object used like this::

+     with assertRaises(SomeException):
+         do_something()

+The context manager keeps a reference to the exception as
+the 'exception' attribute. This allows you to inspect the
+exception after the assertion::

+    with assertRaises(SomeException) as cm:
+        do_something()
+    the_exception = cm.exception
+    assertEqual(the_exception.error_code, 3)
+ +
assertRaisesRegexp(self, expected_exception, expected_regexp, callable_obj=None, *args, **kwargs)
Asserts that the message in a raised exception matches a regexp.

+Args:
+    expected_exception: Exception class expected to be raised.
+    expected_regexp: Regexp (re pattern object or string) expected
+            to be found in error message.
+    callable_obj: Function to be called.
+    args: Extra args.
+    kwargs: Extra kwargs.
+ +
assertRegexpMatches(self, text, expected_regexp, msg=None)
Fail the test unless the text matches the regular expression.
+ +
assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None)
An equality assertion for ordered sequences (like lists and tuples).

+For the purposes of this function, a valid ordered sequence type is one
+which can be indexed, has a length, and has an equality operator.

+Args:
+    seq1: The first sequence to compare.
+    seq2: The second sequence to compare.
+    seq_type: The expected datatype of the sequences, or None if no
+            datatype should be enforced.
+    msg: Optional message to use on failure instead of a list of
+            differences.
+ +
assertSetEqual(self, set1, set2, msg=None)
A set-specific equality assertion.

+Args:
+    set1: The first set to compare.
+    set2: The second set to compare.
+    msg: Optional message to use on failure instead of a list of
+            differences.

+assertSetEqual uses ducktyping to support different types of sets, and
+is optimized for sets specifically (parameters must support a
+difference method).
+ +
assertTrue(self, expr, msg=None)
Check that the expression is true.
+ +
assertTupleEqual(self, tuple1, tuple2, msg=None)
A tuple-specific equality assertion.

+Args:
+    tuple1: The first tuple to compare.
+    tuple2: The second tuple to compare.
+    msg: Optional message to use on failure instead of a list of
+            differences.
+ +
assert_ = assertTrue(self, expr, msg=None)
Check that the expression is true.
+ +
countTestCases(self)
+ +
debug(self)
Run the test without collecting errors in a TestResult
+ +
defaultTestResult(self)
+ +
doCleanups(self)
Execute all cleanup functions. Normally called for you after
+tearDown.
+ +
fail(self, msg=None)
Fail immediately, with the given message.
+ +
failIf = deprecated_func(*args, **kwargs)
+ +
failIfAlmostEqual = deprecated_func(*args, **kwargs)
+ +
failIfEqual = deprecated_func(*args, **kwargs)
+ +
failUnless = deprecated_func(*args, **kwargs)
+ +
failUnlessAlmostEqual = deprecated_func(*args, **kwargs)
+ +
failUnlessEqual = deprecated_func(*args, **kwargs)
+ +
failUnlessRaises = deprecated_func(*args, **kwargs)
+ +
id(self)
+ +
run(self, result=None)
+ +
shortDescription(self)
Returns a one-line description of the test, or None if no
+description has been provided.

+The default implementation of this method returns the first line of
+the specified test method's docstring.
+ +
skipTest(self, reason)
Skip this test.
+ +
+Class methods inherited from unittest.case.TestCase:
+
setUpClass(cls) from __builtin__.type
Hook method for setting up class fixture before running tests in the class.
+ +
tearDownClass(cls) from __builtin__.type
Hook method for deconstructing the class fixture after running all tests in the class.
+ +
+Data descriptors inherited from unittest.case.TestCase:
+
__dict__
+
dictionary for instance variables (if defined)
+
+
__weakref__
+
list of weak references to the object (if defined)
+
+
+Data and other attributes inherited from unittest.case.TestCase:
+
failureException = <type 'exceptions.AssertionError'>
Assertion failed.
+ +
longMessage = False
+ +
maxDiff = 640
+ +

+ \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..42dca95 --- /dev/null +++ b/setup.py @@ -0,0 +1,17 @@ +from distutils.core import setup + +setup( + name='Tippy', + version='0.1.0', + author='Julien Lengrand-Lambert', + author_email='julien@lengrand.fr', + packages=['tippy', 'tippy.tests', 'examples'], + scripts=[''], + url='https://github.com/jlengrand/Tippy', + license='LICENSE.txt', + description='another Toolbox for Image Processing in PYthon, based on OpenCV', + long_description=open('README.txt').read(), + install_requires=[ + "OpenCV >= 3.1", + ], +) \ No newline at end of file