Public Member Functions | Public Attributes | Private Attributes | List of all members
application_util.image_viewer.ImageViewer Class Reference
Inheritance diagram for application_util.image_viewer.ImageViewer:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, update_ms, window_shape=(640, 480), caption="Figure 1")
 
def annotate (self, x, y, text)
 
def circle (self, x, y, radius, label=None)
 
def color (self)
 
def color (self, value)
 
def colored_points (self, points, colors=None, skip_index_check=False)
 
def disable_videowriter (self)
 
def enable_videowriter (self, output_filename, fourcc_string="MJPG", fps=None)
 
def gaussian (self, mean, covariance, label=None)
 
def rectangle (self, x, y, w, h, label=None)
 
def run (self, update_fun=None)
 
def stop (self)
 

Public Attributes

 image
 
 text_color
 
 thickness
 
- Public Attributes inherited from object
pointer iv [2]
 

Private Attributes

 _caption
 
 _color
 
 _terminate
 
 _update_ms
 
 _user_fun
 
 _video_writer
 
 _window_shape
 

Detailed Description

An image viewer with drawing routines and video capture capabilities.

Key Bindings:

* 'SPACE' : pause
* 'ESC' : quit

Parameters
----------
update_ms : int
    Number of milliseconds between frames (1000 / frames per second).
window_shape : (int, int)
    Shape of the window (width, height).
caption : Optional[str]
    Title of the window.

Attributes
----------
image : ndarray
    Color image of shape (height, width, 3). You may directly manipulate
    this image to change the view. Otherwise, you may call any of the
    drawing routines of this class. Internally, the image is treated as
    beeing in BGR color space.

    Note that the image is resized to the the image viewers window_shape
    just prior to visualization. Therefore, you may pass differently sized
    images and call drawing routines with the appropriate, original point
    coordinates.
color : (int, int, int)
    Current BGR color code that applies to all drawing routines.
    Values are in range [0-255].
text_color : (int, int, int)
    Current BGR text color code that applies to all text rendering
    routines. Values are in range [0-255].
thickness : int
    Stroke width in pixels that applies to all drawing routines.

Definition at line 61 of file image_viewer.py.

Constructor & Destructor Documentation

def application_util.image_viewer.ImageViewer.__init__ (   self,
  update_ms,
  window_shape = (640, 480),
  caption = "Figure 1" 
)

Definition at line 101 of file image_viewer.py.

Member Function Documentation

def application_util.image_viewer.ImageViewer.annotate (   self,
  x,
  y,
  text 
)
Draws a text string at a given location.

Parameters
----------
x : int | float
    Bottom-left corner of the text in the image (x-axis).
y : int | float
    Bottom-left corner of the text in the image (y-axis).
text : str
    The text to be drawn.

Definition at line 213 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.circle (   self,
  x,
  y,
  radius,
  label = None 
)
Draw a circle.

Parameters
----------
x : float | int
    Center of the circle (x-axis).
y : float | int
    Center of the circle (y-axis).
radius : float | int
    Radius of the circle in pixels.
label : Optional[str]
    A text label that is placed at the center of the circle.

Definition at line 156 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.color (   self)

Definition at line 115 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.color (   self,
  value 
)

Definition at line 119 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.colored_points (   self,
  points,
  colors = None,
  skip_index_check = False 
)
Draw a collection of points.

The point size is fixed to 1.

Parameters
----------
points : ndarray
    The Nx2 array of image locations, where the first dimension is
    the x-coordinate and the second dimension is the y-coordinate.
colors : Optional[ndarray]
    The Nx3 array of colors (dtype=np.uint8). If None, the current
    color attribute is used.
skip_index_check : Optional[bool]
    If True, index range checks are skipped. This is faster, but
    requires all points to lie within the image dimensions.

Definition at line 229 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.disable_videowriter (   self)
Disable writing videos.

Definition at line 280 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.enable_videowriter (   self,
  output_filename,
  fourcc_string = "MJPG",
  fps = None 
)
Write images to video file.

Parameters
----------
output_filename : str
    Output filename.
fourcc_string : str
    The OpenCV FOURCC code that defines the video codec (check OpenCV
    documentation for more information).
fps : Optional[float]
    Frames per second. If None, configured according to current
    parameters.

Definition at line 259 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.gaussian (   self,
  mean,
  covariance,
  label = None 
)
Draw 95% confidence ellipse of a 2-D Gaussian distribution.

Parameters
----------
mean : array_like
    The mean vector of the Gaussian distribution (ndim=1).
covariance : array_like
    The 2x2 covariance matrix of the Gaussian distribution.
label : Optional[str]
    A text label that is placed at the center of the ellipse.

Definition at line 186 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.rectangle (   self,
  x,
  y,
  w,
  h,
  label = None 
)
Draw a rectangle.

Parameters
----------
x : float | int
    Top left corner of the rectangle (x-axis).
y : float | int
    Top let corner of the rectangle (y-axis).
w : float | int
    Width of the rectangle.
h : float | int
    Height of the rectangle.
label : Optional[str]
    A text label that is placed at the top left corner of the
    rectangle.

Definition at line 124 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.run (   self,
  update_fun = None 
)
Start the image viewer.

This method blocks until the user requests to close the window.

Parameters
----------
update_fun : Optional[Callable[] -> None]
    An optional callable that is invoked at each frame. May be used
    to play an animation/a video sequence.

Definition at line 285 of file image_viewer.py.

def application_util.image_viewer.ImageViewer.stop (   self)
Stop the control loop.

After calling this method, the viewer will stop execution before the
next frame and hand over control flow to the user.

Parameters
----------

Definition at line 335 of file image_viewer.py.

Member Data Documentation

application_util.image_viewer.ImageViewer._caption
private

Definition at line 103 of file image_viewer.py.

application_util.image_viewer.ImageViewer._color
private

Definition at line 110 of file image_viewer.py.

application_util.image_viewer.ImageViewer._terminate
private

Definition at line 107 of file image_viewer.py.

application_util.image_viewer.ImageViewer._update_ms
private

Definition at line 104 of file image_viewer.py.

application_util.image_viewer.ImageViewer._user_fun
private

Definition at line 106 of file image_viewer.py.

application_util.image_viewer.ImageViewer._video_writer
private

Definition at line 105 of file image_viewer.py.

application_util.image_viewer.ImageViewer._window_shape
private

Definition at line 102 of file image_viewer.py.

application_util.image_viewer.ImageViewer.image

Definition at line 109 of file image_viewer.py.

application_util.image_viewer.ImageViewer.text_color

Definition at line 111 of file image_viewer.py.

application_util.image_viewer.ImageViewer.thickness

Definition at line 112 of file image_viewer.py.


The documentation for this class was generated from the following file:


jsk_perception
Author(s): Manabu Saito, Ryohei Ueda
autogenerated on Mon May 3 2021 03:03:27