Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pnuu/halostack
Browse files Browse the repository at this point in the history
  • Loading branch information
pnuu committed May 24, 2015
2 parents 52708cf + 48593cd commit e5915b0
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 16 deletions.
18 changes: 16 additions & 2 deletions doc/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,28 @@ to check what is the initial estimate from the automatic version.
Green - Red
+++++++++++

The Green - Red method is otherwise equal to the Blue - Red method described
above, but in this case the first channel is different.
The Green - Red method is otherwise equal to the Blue - Red method
described above, but in this case the first channel is different. May
yield better results thatn Blue - Red in some cases.

Syntax::

-E gr
-E gr:1.5

Blue - Green
+++++++++++

The Blue - Green method is otherwise equal to the Blue - Red method
described above, but in this case the channels re different. This
method can be handy when trying to reveal the fifth order rainbow
between the primary and secondary rainbows.

Syntax::

-E bg
-E bg:1.5

Gradient removal
++++++++++++++++

Expand Down
45 changes: 31 additions & 14 deletions halostack/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,28 @@ def enhance(self, enhancements):
* ``float``: multiplier for blue channel [``mean(red/green)``]
* ``gr``: Green - Red
* possible calls:
* ``{'gr': None}``
* ``{'gr': float}``
* optional arguments:
* ``float``: multiplier for red channel [``mean(green/red)``]
* ``bg``: Blue - Green
* possible calls:
* ``{'bg': None}``
* ``{'bg': float}``
* optional arguments:
* ``float``: multiplier for blue channel [``mean(blue/green)``]
* ``emboss``: emboss image using *ImageMagick*
* possible calls:
Expand Down Expand Up @@ -277,17 +299,6 @@ def enhance(self, enhancements):
* ``float`` (blur radius) [``min(image dimensions)/20``]
* ``gr``: Green - Red
* possible calls:
* ``{'gr': None}``
* ``{'gr': float}``
* optional arguments:
* ``float``: multiplier for red channel [``mean(green/red)``]
* ``rgb_sub``: Subtract luminance from each color channel
* possible calls:
Expand Down Expand Up @@ -345,6 +356,7 @@ def enhance(self, enhancements):
'gamma': self._gamma,
'br': self._blue_red_subtract,
'gr': self._green_red_subtract,
'bg': self._blue_green_subtract,
'rgb_sub': self._rgb_subtract,
'rgb_mix': self._rgb_mix,
'gradient': self._remove_gradient,
Expand Down Expand Up @@ -390,6 +402,13 @@ def _green_red_subtract(self, args):
LOGGER.debug("Calculating channel difference, Green - Red.")
self._channel_difference(1, 0, multiplier=args)

def _blue_green_subtract(self, args):
'''Subtract green channel from the blue channel after scaling
the green channel using the supplied multiplier.
'''
LOGGER.debug("Calculating channel difference, Blue - Green.")
self._channel_difference(2, 1, multiplier=args)

def _rgb_subtract(self, args):
'''Subtract mean(r,g,b) from all the channels.
'''
Expand Down Expand Up @@ -657,7 +676,7 @@ def gaussian_kernel(radius, sigma):
''' Generate a gaussian convolution kernel.
'param radius: kernel radius in pixels
'type radisu: int
'type radius: int
'param sigma': standard deviation of the gaussian in pixels
'type sigma: float
'''
Expand All @@ -672,8 +691,6 @@ def gaussian_kernel(radius, sigma):
kernel[:radius+1] = half_kernel[::-1]
kernel /= np.sum(kernel)

print sigma2

return kernel

kernel = gaussian_kernel(radius, sigma)
Expand Down

0 comments on commit e5915b0

Please sign in to comment.