
\c           @   sb   d  d l  m Z d  d l Z d d g Z d d  Z d   Z d   Z e j e _ e j e _ d S(	   i(   t   string_typesNt	   load_siftt	   load_surft   SIFTc         C   s  t  |  t  r' t |  d  } t } n |  } t } | d k r t t | j   j    \ } } t	 j
 d t f d t f d t f d t f d t | f f g  } nv d } t | j    d	 } t | j    } t	 j
 d t f d t f d
 t d f f d t f d t | f f g  } t	 j | d d } | j | | j t	 j
 t  j k rnt d j |    n  | r| j   n  | j |  S(   s	  Read SIFT or SURF features from externally generated file.

    This routine reads SIFT or SURF files generated by binary utilities from
    http://people.cs.ubc.ca/~lowe/keypoints/ and
    http://www.vision.ee.ethz.ch/~surf/.

    This routine *does not* generate SIFT/SURF features from an image.  These
    algorithms are patent encumbered.  Please use `skimage.feature.CENSURE`
    instead.

    Parameters
    ----------
    filelike : string or open file
        Input file generated by the feature detectors from
        http://people.cs.ubc.ca/~lowe/keypoints/ or
        http://www.vision.ee.ethz.ch/~surf/ .
    mode : {'SIFT', 'SURF'}, optional
        Kind of descriptor used to generate `filelike`.

    Returns
    -------
    data : record array with fields
      - row: int
          row position of feature
      - column: int
          column position of feature
      - scale: float
          feature scale
      - orientation: float
          feature orientation
      - data: array
          feature values

    t   rR   t   rowt   columnt   scalet   orientationt   datat   SURFi   t   second_momenti   t   signt   sept    s   Invalid {} feature file.(   t
   isinstanceR    t   opent   Truet   Falset   mapt   intt   readlinet   splitt   npt   dtypet   floatt   fromfilet   sizet   itemsizet   IOErrort   formatt   closet   view(   t   fileliket   modet   ft   filelike_is_strt   nr_featurest   feature_lent   datatypeR	   (    (    s.   lib/python2.7/site-packages/skimage/io/sift.pyt
   _sift_read   s,    #	!!&c         C   s   t  |  d d S(   NR"   R   (   R(   (   R#   (    (    s.   lib/python2.7/site-packages/skimage/io/sift.pyR   I   s    c         C   s   t  |  d d S(   NR"   R
   (   R(   (   R#   (    (    s.   lib/python2.7/site-packages/skimage/io/sift.pyR   M   s    (	   t   sixR    t   numpyR   t   __all__R(   R   R   t   __doc__(    (    (    s.   lib/python2.7/site-packages/skimage/io/sift.pyt   <module>   s   B		