Source code for pysteg.features.correlation

#! /usr/bin/env python
##  $Id$
## -*- coding: utf-8 -*-

"""
Calculating the correlation coefficient of adjacent pixels as
used in cover selection.

:Module:    pysteg.features.correlation
:Date:      $Date$
:Revision:  $Revision$
:Copyright: (C) 2012: Hans Georg Schaathun <georg@schaathun.net> 
"""

print "[pysteg.features.correlation] $Id$"

# ***************************
# pysteg.features.correlation
# ***************************
#
# .. module:: pysteg.features.correlation
#   

import numpy as np
from .homgen import diffMatrix

[docs]def corrfeature(I): "Calculate the WAM(N)-27 from the pixmap array I." if I == None: return [ "corr-hor", "corr-ver" ] I = I.astype(float) h = np.corrcoef( I[:,:-1].flatten(), I[:,1:].flatten() ) v = np.corrcoef( I[:-1,:].flatten(), I[1:,:].flatten() ) return [h[0,1],v[0,1]]
if __name__ == "__main__": print ccNames()