Skip to content
Closed

Image #378

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b962b9b
basic support for images (python 3 version)
l1ebl Apr 27, 2016
e64d4c9
work in progress: basic Image[] functionality
l1ebl Apr 28, 2016
7aea018
some morphology functions; inout.py fix
l1ebl Apr 28, 2016
6b87466
scikit-image is now optional
l1ebl Apr 28, 2016
d7f31b2
min, max, median filters
l1ebl Apr 28, 2016
b7e8271
Colorize
l1ebl Apr 29, 2016
cafb988
cleanup
l1ebl Apr 29, 2016
54d22ef
PixelValuePositions
l1ebl Apr 29, 2016
be75709
import and export for multiple formats, some image method tuning
l1ebl Apr 29, 2016
8adcfc4
added image module to builtin module's init
l1ebl Apr 29, 2016
d9acdba
a bit of python2 compatibility
l1ebl Apr 29, 2016
fdca161
some comments in the file head
l1ebl Apr 29, 2016
d91d63b
fixed encoding logic for python2/3
l1ebl Apr 29, 2016
893c29a
implement arbitrary arg Image arithmetic
sn6uv May 1, 2016
14381f7
Image arithmetic docs and tests
sn6uv May 1, 2016
044a288
wrap image in <mtext> (within <math>) to allow images within expressions
sn6uv May 1, 2016
6047349
fix Integer.get_real_value
sn6uv May 4, 2016
ab39e21
tests and docs for RandomImage
sn6uv May 4, 2016
9cb1db3
image import examples
sn6uv May 4, 2016
2f37966
(failing) multiplicative and additive noise examples
sn6uv May 4, 2016
264c7a4
remove duplicate jpeg import/exporters
sn6uv May 4, 2016
1df5b08
fixup image tests
sn6uv May 4, 2016
c780eb3
pep8 cleanups
sn6uv May 4, 2016
718669f
cleanup ImageResize
sn6uv May 4, 2016
2c4e966
fix ImageResize option bug and Gaussian resize rounding bug
sn6uv May 4, 2016
8127487
fix Gaussian sampling aspect ratio message
sn6uv May 4, 2016
b1fe8e2
cleanup morphology filters
sn6uv May 4, 2016
ce339a1
morphology docs
sn6uv May 4, 2016
da52c54
cleanup image arith functions
sn6uv May 4, 2016
946d114
only import image module when enabled
sn6uv May 4, 2016
9bbdb76
add numpy/skimage build to travis
sn6uv May 4, 2016
e8b3f96
only test for the minimum import/export formats supported
sn6uv May 4, 2016
0eb414e
move image tests to image module
sn6uv May 4, 2016
99b8cab
cleanp image arith
sn6uv May 4, 2016
f518b7c
RandomImage RGB colorspace
sn6uv May 5, 2016
d9e6c69
a much more robust implementation for Colorize[]
l1ebl May 10, 2016
86bde9f
ImageCreate[] now checks if pixel dimensions are ok
l1ebl May 10, 2016
ee2bbfd
implement ImageReflect full spec
sn6uv May 15, 2016
9a25a53
ImageRotate docs
sn6uv May 15, 2016
7df4bb6
remove Image.to_sympy (see what breaks)
sn6uv May 15, 2016
de82e99
ImagePartition docs and tweak
sn6uv May 21, 2016
5fd8953
ImageAdjust
sn6uv May 21, 2016
64147b5
removed ImageCreate[] in favour of Image[] alone. adds width and heig…
l1ebl May 24, 2016
f2e83d8
adds support for classic Mathics branch
l1ebl May 24, 2016
4e44409
adds ImageQ
l1ebl May 24, 2016
8fe3c5d
changed ImageQ to Test, fixed BinaryImageQ (was Test, but did not def…
l1ebl May 25, 2016
898216b
one more test case for ImageQ
l1ebl May 25, 2016
0eca41b
Merge pull request #3 from poke1024/sn6uv-image3
sn6uv May 25, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env:
global:
- SYMPY_SRC=sympy-1.0
- DOC="false"
- NUMPY="false"
- SKIMAGE="false"
matrix:
- CYTHON="false"
- CYTHON="true"
Expand All @@ -25,6 +27,10 @@ matrix:
env: SYMPY_SRC=master CYTHON="false"
- python: 3.5
env: SYMPY_SRC=master CYTHON="false"
- python: 2.7
env: NUMPY="true" SKIMAGE="true"
- python: 3.5
env: NUMPY="true" SKIMAGE="true"
exclude:
# PyPy is not compatible with Cython
- python: pypy
Expand All @@ -46,6 +52,13 @@ before_install:
- if [[ "$CYTHON" == "true" ]]; then
pip install cython;
fi
- if [[ "$NUMPY" == "true" ]]; then
sudo apt-get update -qq &&
sudo apt-get install -qq python-numpy;
fi
- if [[ "$SKIMAGE" == "true" ]]; then
pip install scikit-image;
fi
- pip install unittest2
- pip install pexpect
- pip install git+https://github.com/sympy/sympy.git@$SYMPY_SRC
Expand Down
14 changes: 14 additions & 0 deletions mathics/autoload/formats/Image/Export.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(* Image Exporter *)

Begin["System`Convert`Image`"]

RegisterImageExport[type_] := RegisterExport[
type,
System`ImageExport,
Options -> {},
BinaryFormat -> True
];

RegisterImageExport[#]& /@ {"BMP", "GIF", "JPEG2000", "JPEG", "PCX", "PNG", "PPM", "PBM", "PGM", "TIFF"};

End[]
16 changes: 16 additions & 0 deletions mathics/autoload/formats/Image/Import.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(* Image Importer *)

Begin["System`Convert`Image`"]

RegisterImageImport[type_] := RegisterImport[
type,
System`ImageImport,
{},
AvailableElements -> {"Image"},
DefaultElement -> "Image",
FunctionChannels -> {"FileNames"}
];

RegisterImageImport[#]& /@ {"BMP", "GIF", "JPEG2000", "JPEG", "PCX", "PNG", "PPM", "PBM", "PGM", "TIFF", "ICO", "TGA"};

End[]
4 changes: 4 additions & 0 deletions mathics/builtin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
from mathics.builtin import files, importexport
modules += [files, importexport]

from mathics.builtin import image
if image._enabled:
modules.append(image)

builtins = []
builtins_by_module = {}

Expand Down
14 changes: 13 additions & 1 deletion mathics/builtin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@ def contextify_form_name(f):
makeboxes_def.add_rule(rule)

@classmethod
def get_name(cls):
def get_name(cls, short=False):
if cls.name is None:
shortname = cls.__name__
else:
shortname = cls.name
if short:
return shortname
return cls.context + shortname

def get_operator(self):
Expand Down Expand Up @@ -215,6 +217,16 @@ def init(self, *args, **kwargs):
pass


class AtomBuiltin(Builtin):
# allows us to define apply functions, rules, messages, etc. for Atoms
# which are by default not in the definitions' contribution pipeline.
# see Image[] for an example of this.

def get_name(self):
name = super(AtomBuiltin, self).get_name()
return re.sub(r"Atom$", "", name)


class Operator(Builtin):
operator = None
precedence = None
Expand Down
Loading