#include <ContourOverlay.h>
This class is an overlay that draws a set of contours onto an image.
◆ ContourOverlay()
| ContourOverlay::ContourOverlay |
( |
std::vector< std::vector< cv::Point > > |
contour, |
|
|
cv::Scalar |
color, |
|
|
cv::Size |
baseImageSize |
|
) |
| |
This will construct a new contour overlay.
- Parameters
-
| contour | These are the contours to draw, in the coordinates of the base image. |
| color | This is the color that the contours are to be drawn in. |
| baseImageSize | This is the size of the image that the contours were found in. |
◆ ~ContourOverlay()
| ContourOverlay::~ContourOverlay |
( |
| ) |
|
|
virtual |
This is the destructor for the class.
This is the destructor for the class. The base class destructor is called automatically after this one, so it must not be called explicitly here.
◆ applyOverlay()
| void ContourOverlay::applyOverlay |
( |
cv::Mat * |
image | ) |
|
|
virtual |
This method will draw the contours onto the given image, using their original coordinates.
- Parameters
-
| image | This is the image that the contours are to be drawn on. |
Implements SWE4211RPi::AbstractImageOverlay.
◆ applyScaledOverlay()
| void ContourOverlay::applyScaledOverlay |
( |
cv::Mat * |
image | ) |
|
|
virtual |
This method will draw the contours onto the given image, scaling them to match the size of the image.
- Parameters
-
| image | This is the image that the contours are to be drawn on. |
This method will draw the contours onto the given image, scaling them to match the size of the image. The scaled contours are kept, so the scaling is only redone when the image size changes.
- Parameters
-
| image | This is the image that the contours are to be drawn on. |
-
If the contours have not yet been scaled, or the image is a different size than they were last scaled for,
-
Clear out the previously scaled contours.
-
Determine the scale factors from the base image size to this image's size.
-
Scale each point of each contour, rounding to the nearest pixel.
-
Remember the size the contours were scaled for.
-
Draw all of the scaled contours onto the image with a line thickness of 3.
Implements SWE4211RPi::AbstractImageOverlay.
◆ baseImageSize
| cv::Size SWE4211RPi::ContourOverlay::baseImageSize |
|
private |
This is the size of the image that the contours were found in.
◆ color
| cv::Scalar SWE4211RPi::ContourOverlay::color |
|
private |
This is the color that the contours are drawn in.
◆ contour
| std::vector<std::vector<cv::Point> > SWE4211RPi::ContourOverlay::contour |
|
private |
These are the contours to draw, in the coordinates of the base image. Each contour is a list of points.
◆ scaledContour
| std::vector<std::vector<cv::Point> > SWE4211RPi::ContourOverlay::scaledContour |
|
private |
These are the contours scaled to the size of the image they were last drawn on. They are kept so that the scaling only needs to be redone when the image size changes.
◆ scaledContourSize
| cv::Size SWE4211RPi::ContourOverlay::scaledContourSize |
|
private |
This is the size of the image that scaledContour has been scaled to.
The documentation for this class was generated from the following files:
- /media/sf_lwshare/20262027SWE4211AllLabSolutions/Lab11/solution/pi/src/imageTransmitter/provided/ContourOverlay.h
- /media/sf_lwshare/20262027SWE4211AllLabSolutions/Lab11/solution/pi/src/imageTransmitter/provided/ContourOverlay.cpp