(self, fig, gs, cropsize=None, rostopic=None, show_overlay_buttons=False)
If rostopic is given to this constructor, then the image visualizer will 
        automatically update with rostopic image. Else, the update method must 
        be manually called to supply images.
If rostopic is given to this constructor, then the image visualizer will 
        automatically update with rostopic image. Else, the update method must 
        be manually called to supply images.
If rostopic is given to this constructor then the image visualizer will automatically update with rostopic image . Else the update method must be manually called to supply images .
def __init__(self, fig, gs, cropsize=None, rostopic=None, show_overlay_buttons=False):
        """
        If rostopic is given to this constructor, then the image visualizer will 
        automatically update with rostopic image. Else, the update method must 
        be manually called to supply images.
        """
        # Real-time image
        self._t = 0
        self._current_image = None
        self._crop_size = cropsize

        # Image overlay
        self._initial_image_overlay_on = False
        self._target_image_overlay_on = False
        self._initial_image = None
        self._initial_alpha = None
        self._target_image = None
        self._target_alpha = None
        self._default_image = np.zeros((1, 1, 3))
        self._default_alpha = 0.0

        # Actions
        actions_arr = [
            Action('oii', 'overlay_initial_image', self.toggle_initial_image_overlay, axis_pos=0),
            Action('oti', 'overlay_target_image',  self.toggle_target_image_overlay,  axis_pos=1),
        ]

        # GUI Components
        self._fig = fig
        self._gs = gridspec.GridSpecFromSubplotSpec(8, 1, subplot_spec=gs)
        self._gs_action_panel = self._gs[0:1, 0]
        self._gs_image_axis  = self._gs[1:8, 0]

        if show_overlay_buttons:
            self._action_panel = ActionPanel(self._fig, self._gs_action_panel, 1, 2, actions_arr)

        self._ax_image = plt.subplot(self._gs_image_axis)
        self._ax_image.set_axis_off()
        self._plot = self._ax_image.imshow(self._default_image)
        self._overlay_plot_initial = self._ax_image.imshow(self._default_image, alpha=self._default_alpha)
        self._overlay_plot_target  = self._ax_image.imshow(self._default_image, alpha=self._default_alpha)

        self._fig.canvas.draw()
        self._fig.canvas.flush_events()   # Fixes bug with Qt4Agg backend

        # ROS subscriber for PS3 controller
        if rostopic and ROS_ENABLED:
            rospy.Subscriber(rostopic, Image, self.update_ros, queue_size=1,
                             buff_size=2**24)
def __init__ ( self , fig , gs , cropsize = None , rostopic = None , show_overlay_buttons = False ) : # Real-time image self . _t = 0 self . _current_image = None self . _crop_size = cropsize # Image overlay self . _initial_image_overlay_on = False self . _target_image_overlay_on = False self . _initial_image = None self . _initial_alpha = None self . _target_image = None self . _target_alpha = None self . _default_image = np . zeros ( ( 1 , 1 , 3 ) ) self . _default_alpha = 0.0 # Actions actions_arr = [ Action ( 'oii' , 'overlay_initial_image' , self . toggle_initial_image_overlay , axis_pos = 0 ) , Action ( 'oti' , 'overlay_target_image' , self . toggle_target_image_overlay , axis_pos = 1 ) , ] # GUI Components self . _fig = fig self . _gs = gridspec . GridSpecFromSubplotSpec ( 8 , 1 , subplot_spec = gs ) self . _gs_action_panel = self . _gs [ 0 : 1 , 0 ] self . _gs_image_axis = self . _gs [ 1 : 8 , 0 ] if show_overlay_buttons : self . _action_panel = ActionPanel ( self . _fig , self . _gs_action_panel , 1 , 2 , actions_arr ) self . _ax_image = plt . subplot ( self . _gs_image_axis ) self . _ax_image . set_axis_off ( ) self . _plot = self . _ax_image . imshow ( self . _default_image ) self . _overlay_plot_initial = self . _ax_image . imshow ( self . _default_image , alpha = self . _default_alpha ) self . _overlay_plot_target = self . _ax_image . imshow ( self . _default_image , alpha = self . _default_alpha ) self . _fig . canvas . draw ( ) self . _fig . canvas . flush_events ( ) # Fixes bug with Qt4Agg backend # ROS subscriber for PS3 controller if rostopic and ROS_ENABLED : rospy . Subscriber ( rostopic , Image , self . update_ros , queue_size = 1 , buff_size = 2 ** 24 )