
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/features_detection/plot_censure.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_features_detection_plot_censure.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_features_detection_plot_censure.py:


========================
CENSURE feature detector
========================

The CENSURE feature detector is a scale-invariant center-surround detector
(CENSURE) that claims to outperform other detectors and is capable of real-time
implementation.

.. GENERATED FROM PYTHON SOURCE LINES 10-58



.. image-sg:: /auto_examples/features_detection/images/sphx_glr_plot_censure_001.png
   :alt: Original Image, Transformed Image
   :srcset: /auto_examples/features_detection/images/sphx_glr_plot_censure_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    from skimage import data
    from skimage import transform
    from skimage.feature import CENSURE
    from skimage.color import rgb2gray

    import matplotlib.pyplot as plt


    img_orig = rgb2gray(data.astronaut())
    tform = transform.AffineTransform(
        scale=(1.5, 1.5), rotation=0.5, translation=(150, -200)
    )
    img_warp = transform.warp(img_orig, tform)

    detector = CENSURE()

    fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(12, 6))

    detector.detect(img_orig)

    ax[0].imshow(img_orig, cmap=plt.cm.gray)
    ax[0].scatter(
        detector.keypoints[:, 1],
        detector.keypoints[:, 0],
        2**detector.scales,
        facecolors='none',
        edgecolors='r',
    )
    ax[0].set_title("Original Image")

    detector.detect(img_warp)

    ax[1].imshow(img_warp, cmap=plt.cm.gray)
    ax[1].scatter(
        detector.keypoints[:, 1],
        detector.keypoints[:, 0],
        2**detector.scales,
        facecolors='none',
        edgecolors='r',
    )
    ax[1].set_title('Transformed Image')

    for a in ax:
        a.axis('off')

    plt.tight_layout()
    plt.show()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 2.040 seconds)


.. _sphx_glr_download_auto_examples_features_detection_plot_censure.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_censure.ipynb <plot_censure.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_censure.py <plot_censure.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_censure.zip <plot_censure.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
