Volume Cartographer 2.27.0
|
Add a scale marker (ruler or reference image) to a Texture image. More...
#include <vc/texturing/ScaleMarkerGenerator.hpp>
Public Types | |
enum class | Type { Metric = 0 , Imperial , ReferenceImage } |
Scale marker type. More... | |
Public Member Functions | |
ScaleMarkerGenerator ()=default | |
void | setScaleType (Type t) |
Set the scale marker type. More... | |
void | setInputImage (const cv::Mat &i) |
Set the input texture image. More... | |
void | setInputImagePixelSize (double s) |
Set the input texture image pixel size (in microns) More... | |
void | setScaleBarColor (const Color &c) |
Set the scale bar (ruler) color. More... | |
void | setReferenceImage (const cv::Mat &i) |
Set the scale reference image. More... | |
void | setReferenceImagePixelSize (double s) |
Set the reference image pixel size (in microns) More... | |
cv::Mat | compute () |
Compute scale marker and combine with input texture image. More... | |
cv::Mat | getOutputImg () |
Get the computed output image. More... | |
cv::Mat | getOutputScaleImage () |
Get the computed scale marker image. More... | |
Private Member Functions | |
cv::Mat | resize_ref_image_ () |
cv::Mat | generate_scale_bar_ () |
void | draw_tick_label_ (cv::Mat img, const std::string &value, const cv::Point &position) |
Private Attributes | |
Type | type_ {Type::Metric} |
cv::Mat | inputImg_ |
double | inputImgPixSize_ {1.0} |
cv::Mat | scaleImg_ |
cv::Mat | outputImg_ |
Color | scaleBarColor_ {volcart::color::WHITE} |
cv::Mat | refImg_ |
double | refImgPixSize_ {1.0} |
double | scaleFactor_ {1.0} |
std::string | scaleUnit_ {"cm"} |
Add a scale marker (ruler or reference image) to a Texture image.
Adds a ruler bar or a reference image to a Texture image to aid with identifying features and text. To be accurate, the pixel size (in microns) must be set for all provided images.
Input images must be 1 or 3 channels. Output images will be 8bpc RGB.
Definition at line 22 of file ScaleMarkerGenerator.hpp.
|
strong |
Scale marker type.
Definition at line 26 of file ScaleMarkerGenerator.hpp.
|
default |
Default constructor
cv::Mat volcart::texturing::ScaleMarkerGenerator::compute | ( | ) |
Compute scale marker and combine with input texture image.
std::domain_error |
|
private |
Draw a unit label "value + scaleUnit_" at the given position
|
private |
Generate a scale bar at the resolution of the input texture image
|
inline |
Get the computed output image.
Returned image is the input texture image with the scale marker.
Definition at line 69 of file ScaleMarkerGenerator.hpp.
|
inline |
Get the computed scale marker image.
Returned image is only the scale marker.
Definition at line 76 of file ScaleMarkerGenerator.hpp.
|
private |
Resize the reference image to resolution of the input texture image
|
inline |
Set the input texture image.
Definition at line 35 of file ScaleMarkerGenerator.hpp.
|
inline |
Set the input texture image pixel size (in microns)
Definition at line 38 of file ScaleMarkerGenerator.hpp.
|
inline |
Set the scale reference image.
Used when the scale type is Type::ReferenceImage.
Definition at line 52 of file ScaleMarkerGenerator.hpp.
|
inline |
Set the reference image pixel size (in microns)
Definition at line 55 of file ScaleMarkerGenerator.hpp.
|
inline |
Set the scale bar (ruler) color.
Used when the scale type is Type::Imperial or Type::Metric.
Definition at line 45 of file ScaleMarkerGenerator.hpp.
|
inline |
Set the scale marker type.
Definition at line 32 of file ScaleMarkerGenerator.hpp.
|
private |
Input texture image
Definition at line 83 of file ScaleMarkerGenerator.hpp.
|
private |
Pixel size of input texture image (in microns)
Definition at line 85 of file ScaleMarkerGenerator.hpp.
|
private |
Output texture image + scale image
Definition at line 90 of file ScaleMarkerGenerator.hpp.
|
private |
Input reference image
Definition at line 96 of file ScaleMarkerGenerator.hpp.
|
private |
Pixel size of input reference image (in microns)
Definition at line 98 of file ScaleMarkerGenerator.hpp.
|
private |
Color of scale bar
Definition at line 93 of file ScaleMarkerGenerator.hpp.
|
private |
Conversion scale factor between constituent images
Definition at line 101 of file ScaleMarkerGenerator.hpp.
|
private |
Generated scale image
Definition at line 88 of file ScaleMarkerGenerator.hpp.
|
private |
Text version of scale unit
Definition at line 103 of file ScaleMarkerGenerator.hpp.
|
private |
Scale marker type
Definition at line 80 of file ScaleMarkerGenerator.hpp.