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

.. only:: html

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

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

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

.. _sphx_glr_examples_visualab_example_efficient_sam_seg_w_prompt.py:


Image segmentation using EfficientSAM with prompt
============================================================

This example runs an interactive demo which allows user to select a region of interest and generate a mask for it.
It can be used on edge devices like Nvidia Jetson Nano/TX2/Xavier NX/AGX with a higher speed than SAM.

.. GENERATED FROM PYTHON SOURCE LINES 8-27

.. code-block:: default


    import os

    import cv2
    import matplotlib.pyplot as plt

    import rofunc as rf

    image_path = os.path.join(rf.oslab.get_rofunc_path(), "../examples/data/visualab/truck.jpg")
    image = cv2.imread(image_path)
    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
    plt.figure(figsize=(10, 10))
    plt.imshow(image)
    plt.axis('off')
    plt.show()
    rf.visualab.efficient_sam_predict(image,
                                      use_point=False,
                                      use_box=True,
                                      efficient_sam_checkpoint="efficientsam_s_gpu.jit")


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

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


.. _sphx_glr_download_examples_visualab_example_efficient_sam_seg_w_prompt.py:

.. only:: html

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




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

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

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

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


.. only:: html

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

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