|
rock_widget_collection
0.1
|
Image viewer with optional text and geometry overlay functionality. More...
#include <ImageView.h>
Inherits QWidget.
Public Types | |
| enum | TextLocation { TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT } |
| Text overlay alignment specification. More... | |
Public Slots | |
| const QColor & | getBackgroundColor () const |
| void | setBackgroundColor (const QColor &color) |
| bool | useProgressIndicator () |
| void | setUseProgressIndicator (bool use) |
| bool | useSmoothTransformation () |
| void | setSmoothTransformation (bool smooth) |
| const int | getProgressIndicatorTimeout () const |
| void | setProgressIndicatorTimeout (int timeout) |
| void | setInvertColor (bool invert) |
| bool | getInvertColor () |
Signals | |
| void | clickedImage (const QPoint &point) |
| Mouse click coordinates in image. More... | |
Public Member Functions | |
| ImageView (QWidget *parent=0) | |
| virtual | ~ImageView () |
| QSize | sizeHint () const |
| void | setRgbSwapped (bool swapped) |
| bool | getRgbSwapped () |
| void | addCircle (QPointF ¢er, double radius, QColor &color, int width, bool persistent=0) |
| Draws circle overlay. More... | |
| void | addLine (QLineF &line, QColor &color, int width, bool persistent=0) |
| Draws line overlay. More... | |
| void | addPolygon (QPolygonF &polygon, QColor &color, int width, bool persistent=0) |
| Draws polygon overlay. More... | |
| void | addPoints (const QList< int > points_x, QList< int > points_y, QColor &color, int width, bool persistent=0) |
| Draws points overlay (2D point cloud). More... | |
| void | addText (QString text, int location, QColor color=QColor(Qt::black), bool persistent=0) |
| Draws text overlay. More... | |
| void | clearOverlays (bool clear_persistent_items=0) |
| Removes overlays. More... | |
| void | rotate (int deg) |
| Rotates image display. More... | |
| void | saveImage (QString path=QString(), bool overlay=0) |
| Saves current image to file. More... | |
| void | setFrame (const base::samples::DistanceImage &frame) |
| Frame input. More... | |
| void | setFrame (const base::samples::frame::Frame &frame) |
| void | setImage (const QImage &image) |
| void | setRawImage (const QString &mode, int pixel_size, int width, int height, const char *pbuffer, const int size) |
| void | refresh () |
| void | processImage () |
| void | update2 () |
| Wrapper for QWidget::update(). This is due to some QtRuby limitations. More... | |
| int | getHeight () const |
| returns the real height of the underlaying widget More... | |
| int | getWidth () const |
| returns the real width of the underlaying widget More... | |
Protected Member Functions | |
| void | resizeEvent (QResizeEvent *event) |
| void | contextMenuEvent (QContextMenuEvent *event) |
| bool | eventFilter (QObject *obj, QEvent *event) |
Properties | |
| QColor | backgroundColor |
| The widget's background color. More... | |
| bool | use_progress_indicator |
| Display progress indicator widget if no frames have being received for a defined time. More... | |
| int | progress_indicator_timeout |
| The time without frame update in ms after which the progress indicator gets started. More... | |
| bool | use_smooth_transformation |
| Usage of antialiasing techniques during image transformation. More... | |
| bool | rgb_swapped |
| bool | invert_color |
Image viewer with optional text and geometry overlay functionality.
ImageView is designed to display image frames, do minor transformation on the image or enhance it with several possible overlays. The image is always displayed completely while keeping its aspect ratio.
Transformation means resizing and rotation by 90 degree steps. The transformation is only applied to the displayed image and is not kept in saved (exported) images.
There are multiple overlay possibilities to choose from like simple geometric forms or text. Except for text overlays, every overlay is attatched to the image, i.e. any transformation the image might receive is going to be executed on the overlay as well. For example: The overlays are immune to image rotation or scaling. They simple get scaled and rotated as well. Text overlays, on the other hand, are considered as status information. They are attatched to the widget and do not care about image transformation. Nevertheless, they react to widget transformation, e.g. they keep their alignment to the assigned widget corner.
Overlays – image- or widget attatched – may be set persistent or volatile. Volatile overlays are being removed with the next frame update while persistent overlays stay until you remove them. Currently, you can only remove all (persistent) overlays at once.
It is planned to extend ImageView to work as GStreamer video sink in a future version.
Definition at line 47 of file ImageView.h.
Text overlay alignment specification.
The alignment is relative to the corners of the widget (not to the image!).
| Enumerator | |
|---|---|
| TOPLEFT | |
| TOPRIGHT | |
| BOTTOMLEFT | |
| BOTTOMRIGHT | |
Definition at line 110 of file ImageView.h.
| ImageView::ImageView | ( | QWidget * | parent = 0 | ) |
Definition at line 24 of file ImageView.cc.
|
virtual |
Definition at line 167 of file ImageView.cc.
| void ImageView::addCircle | ( | QPointF & | center, |
| double | radius, | ||
| QColor & | color, | ||
| int | width, | ||
| bool | persistent = 0 |
||
| ) |
Draws circle overlay.
Draws a circle overlay with center point center and radius radius. The position has to be submitted in image coordinates with origin in the top left corner.
| width | pen width |
| persistent | If false, the overlay gets deleted with the next frame update. Otherwise not. |
Definition at line 257 of file ImageView.cc.
| void ImageView::addLine | ( | QLineF & | line, |
| QColor & | color, | ||
| int | width, | ||
| bool | persistent = 0 |
||
| ) |
Draws line overlay.
Draws a line overlay. The line is specified in line. The position has to be submitted in image coordinates with origin in the top left corner.
| width | pen width |
| persistent | If false, the overlay gets deleted with the next frame update. Otherwise not. |
Definition at line 269 of file ImageView.cc.
| void ImageView::addPoints | ( | const QList< int > | points_x, |
| QList< int > | points_y, | ||
| QColor & | color, | ||
| int | width, | ||
| bool | persistent = 0 |
||
| ) |
Draws points overlay (2D point cloud).
Draws a points overlay. This is to be understood as a 2D point cloud. The position has to be submitted in image coordinates with origin in the top left corner. Since QtRuby has problems with QList<QPoint> slot signatures, this method uses two lists: one for the x-coordinates and one for the y-coordinates.
Example:
You want to draw the pointcloud {(3,4),(6,8)}. Therefore you have to submit
points_x : {3,6}
points_y : {4,8}
| width | pen width |
| persistent | If false, the overlay gets deleted with the next frame update. Otherwise not. |
Definition at line 280 of file ImageView.cc.
| void ImageView::addPolygon | ( | QPolygonF & | polygon, |
| QColor & | color, | ||
| int | width, | ||
| bool | persistent = 0 |
||
| ) |
Draws polygon overlay.
Draws a polygon overlay. The polygon is specified in line. The position has to be submitted in image coordinates with origin in the top left corner.
| width | pen width |
| persistent | If false, the overlay gets deleted with the next frame update. Otherwise not. |
Definition at line 299 of file ImageView.cc.
| void ImageView::addText | ( | QString | text, |
| int | location, | ||
| QColor | color = QColor(Qt::black), |
||
| bool | persistent = 0 |
||
| ) |
Draws text overlay.
Draws a text overlay. The text is immune to image transformation, i.e. rotation or scaling. The text is in monospace style. You can align the text to the corners.
| location | Text alignment to the corners. The location value is analogous to the TextLocation enum. This is an intermediate solution until we find a way to use the QtRuby binding for enums. For convenience from the ruby side, you can use a wrapper method using symbols. This method is defined in the Vizkit C++ Extensions in image_view_widget.rb. |
| persistent | If false, the overlay gets deleted with the next frame update. Otherwise not. |
Definition at line 312 of file ImageView.cc.
| void ImageView::clearOverlays | ( | bool | clear_persistent_items = 0 | ) |
Removes overlays.
| persistent | If true, removes also persistent overlays. Otherwise not. |
Definition at line 401 of file ImageView.cc.
|
signal |
Mouse click coordinates in image.
Gets emitted if the image receives a mouse click event. The position is in image coordinates where the origin is in the top-left corner.
|
protected |
Definition at line 591 of file ImageView.cc.
|
protected |
Definition at line 596 of file ImageView.cc.
|
slot |
Definition at line 176 of file ImageView.cc.
| int ImageView::getHeight | ( | ) | const |
returns the real height of the underlaying widget
Definition at line 679 of file ImageView.cc.
|
inlineslot |
Definition at line 132 of file ImageView.h.
|
slot |
Definition at line 224 of file ImageView.cc.
|
inline |
Definition at line 134 of file ImageView.h.
| int ImageView::getWidth | ( | ) | const |
returns the real width of the underlaying widget
Definition at line 684 of file ImageView.cc.
| void ImageView::processImage | ( | ) |
Definition at line 507 of file ImageView.cc.
| void ImageView::refresh | ( | ) |
Definition at line 515 of file ImageView.cc.
|
protected |
Definition at line 567 of file ImageView.cc.
| void ImageView::rotate | ( | int | deg | ) |
Rotates image display.
Rotates the image display about deg degrees. The image gets fit into the widget by keeping its aspect ratio.
Definition at line 416 of file ImageView.cc.
| void ImageView::saveImage | ( | QString | path = QString(), |
| bool | overlay = 0 |
||
| ) |
Saves current image to file.
The saved image is either the plain original image or said image with overlays (depending on overlay). The saved image size is always the size of the original image.
| path | Save destination. If not submitted, a file chooser dialog is presented. |
| overlay | Saves overlays, too if set to true. Otherwise only the image is being saved. |
Definition at line 423 of file ImageView.cc.
|
slot |
Definition at line 181 of file ImageView.cc.
| void ImageView::setFrame | ( | const base::samples::DistanceImage & | frame | ) |
Frame input.
| frame | The image to be displayed next. The display gets updated immediately. |
Definition at line 467 of file ImageView.cc.
| void ImageView::setFrame | ( | const base::samples::frame::Frame & | frame | ) |
Definition at line 484 of file ImageView.cc.
| void ImageView::setImage | ( | const QImage & | image | ) |
Definition at line 500 of file ImageView.cc.
|
slot |
Definition at line 689 of file ImageView.cc.
|
slot |
Definition at line 229 of file ImageView.cc.
| void ImageView::setRawImage | ( | const QString & | mode, |
| int | pixel_size, | ||
| int | width, | ||
| int | height, | ||
| const char * | pbuffer, | ||
| const int | size | ||
| ) |
Definition at line 493 of file ImageView.cc.
| void ImageView::setRgbSwapped | ( | bool | swapped | ) |
Definition at line 697 of file ImageView.cc.
|
slot |
Definition at line 215 of file ImageView.cc.
|
slot |
Definition at line 193 of file ImageView.cc.
| QSize ImageView::sizeHint | ( | ) | const |
Definition at line 171 of file ImageView.cc.
| void ImageView::update2 | ( | ) |
Wrapper for QWidget::update(). This is due to some QtRuby limitations.
Definition at line 667 of file ImageView.cc.
|
slot |
Definition at line 187 of file ImageView.cc.
|
slot |
Definition at line 210 of file ImageView.cc.
|
readwrite |
The widget's background color.
You see the widget's background color in the areas not covered by the image. This is likely to happen because of the keeping of the images aspect ratio while fitting it in the view.
Definition at line 59 of file ImageView.h.
|
readwrite |
Definition at line 80 of file ImageView.h.
|
readwrite |
The time without frame update in ms after which the progress indicator gets started.
Definition at line 68 of file ImageView.h.
|
readwrite |
Definition at line 79 of file ImageView.h.
|
readwrite |
Display progress indicator widget if no frames have being received for a defined time.
Definition at line 65 of file ImageView.h.
|
readwrite |
Usage of antialiasing techniques during image transformation.
Do antialiased transformation by using costly techniques like bilinear filtering. That produces higher CPU load but the displayed image is much smoother. This property only applies to the displayed image - not to the overlays.
Definition at line 77 of file ImageView.h.
1.8.13