Property Types#
-
class IProperty#
Subclassed by visionflow::props::FeatureMap, visionflow::props::GaugeRegionList, visionflow::props::IDReaderRegionList, visionflow::props::IRegionList, visionflow::props::Image, visionflow::props::ImageUserData, visionflow::props::MultiNamesPolygonRegionList, visionflow::props::PolygonRegionList, visionflow::props::PolygonWithStringMapRegionList, visionflow::props::RawImageInfo, visionflow::props::RegionMatchResultList, visionflow::props::RotateRectRegionList, visionflow::props::StringMessage, visionflow::props::TaggedPolygonList, visionflow::props::ViewList
-
class Image : public visionflow::props::IProperty#
Property Image.
Public Functions
-
explicit Image(const visionflow::Image &image)#
Construct a new Image object.
- Parameters:
image – visionflow::Image image data.
-
Image(const Image &rhs)#
Copy constructor.
Only copy the image data pointer and raw image infomation, not the data. If you want to copy the data, you should use visionflow::Image::clone().
- Parameters:
rhs – Other Image.
-
Image &operator=(const Image &rhs)#
Assignment operator.
Only copy the image data pointer and raw image infomation, not the data. If you want to copy the data, you should use visionflow::Image::clone().
-
const visionflow::Image &image() const#
Get image data.
- Returns:
NO_DISCARD const visionflow::Image& image data.
-
Image &set_image(visionflow::Image image)#
Set the image data.
- Parameters:
image – visionflow::Image image data.
- Returns:
Image& reference to this object.
Public Static Functions
-
static size_t DumpPrefixLength()#
The property image data dumped with a length-fixed prefix. You can convert the binary data into a common encoded image data by removing the prefix.
-
explicit Image(const visionflow::Image &image)#
-
class ImageUserData : public visionflow::props::IProperty#
ImageUserData is a class used to store user data of images, including thumbnails and additional data. It provides methods for setting and getting thumbnails and setting and getting additional data.
Public Functions
-
ImageUserData &set_thumbnail_image(const img::Image &image, size_t thumbnail_long_side = 256)#
Set the thumbnail image into ImageUserData with thumbnail_long_side.
- Parameters:
image – The raw image.
thumbnail_long_side – The thumbnail long side length. If not specified, the thumbnail size will be zero and the thumbnail image will be empty. Default is 256.
- Returns:
ImageUserData& Returns a reference to the updated ImageUserData object.
-
const visionflow::Image &thumbnail_image() const#
Get the thumbnail of the raw image.
- Returns:
NO_DISCARD the thumbnail of the raw image.
-
ImageUserData &set_user_data(std::string key, Buffer data)#
Set the user data with key. If key already exists, will overwrite the old data.
See also
Note
The data in the buffer will not be copied, Which means that if you modify the data content in the Buffer later, the data in the inserted Buffer will also be modified. If this is not the behavior you expect, you can call visionflow::Buffer::clone_data() explicitly like below:
img_user_data.set_user_data("my-data", buffer.clone_data());
- Parameters:
key – The key of the user data.
data – The user data of the image.
- Returns:
ImageUserData& Returns a reference to the updated ImageUserData object.
-
const Buffer &get_user_data(const std::string &key) const#
Get the user data with key.
- Parameters:
key – The key of the user data
- Throws:
excepts::DataNotFound – If the key of the user data does’t exist.
- Returns:
NO_DISCARD const Buffer& The data.
-
std::vector<std::string> keys() const#
Get all the keys of user data.
- Returns:
NO_DISCARD std::vector<std::string> All keys of the extra user data.
-
bool contains_user_data(const std::string &key) const#
Check if the user data contains the key.
- Parameters:
key – The key of the user data
- Returns:
NO_DISCARD
-
ImageUserData &remove_user_data(const std::string &key)#
Remove user data with key.
Note
If key does not exist, do nothing.
- Parameters:
key – The key of the user data.
- Returns:
ImageUserData& Returns a reference to the updated ImageUserData object.
-
ImageUserData &clear_all_user_data()#
Remove all the user data.
- Returns:
ImageUserData& Returns a reference to the updated ImageUserData object.
-
ImageUserData &set_thumbnail_image(const img::Image &image, size_t thumbnail_long_side = 256)#
-
class RawImageInfo : public visionflow::props::IProperty#
Property to save the raw image information to speed up the image processing.
Public Functions
-
const std::string &file_path() const#
Get image file path.
- Returns:
const std::string& if from_camera() is true, return the camera id.
-
uint32_t channels(size_t visual_idx = 0) const#
Get channel of {visual_idx}th visual.
- Parameters:
visual_idx – Visual index
- Returns:
NO_DISCARD Channel of {visual_idx}th visual.
-
visionflow::img::Image::Depth depth(size_t visual_idx = 0) const#
Get depth of {visual_idx}th visual.
- Parameters:
visual_idx – Visual index
- Returns:
NO_DISCARD Depth of {visual_idx}th visual.
-
const std::string &camera_id() const#
Get image camera id.
- Returns:
const std::string& if from_camera() is false, return file path.
-
bool from_camera() const#
Get whether the image is from camera.
- Returns:
NO_DISCARD true for camera, false for file.
-
const Tags &tags() const#
Get the tags of the raw image.
- Returns:
NO_DISCARD const Tags & the tags of the raw image.
-
Tags &tags()#
Get the mutable tags of the raw image.
- Returns:
NO_DISCARD Tags & the mutable tags of the raw image.
-
const visionflow::Image &thumbnail_image() const#
Get the thumbnail of the raw image.
- Returns:
NO_DISCARD the thumbnail of the raw image.
-
const std::string &image_fingerprint() const#
Get the image fingerprint of the raw image.
- Returns:
NO_DISCARD the fingerprint of the raw image.
-
RawImageInfo &set_info_from_image(const img::Image &image, bool with_fingerprint = false, size_t thumbnail_long_side = 0)#
Collect base image infomation from the raw image object.
- Parameters:
image – The raw image.
with_fingerprint – Save the image fingerprint or not. Typically, when importing images into the project, you should set this parameter to True. When deploying to a production environment, you can set this parameter to False to skip computing image fingerprints and improve speed.
thumbnail_long_side – The thumbnail long side length. If not specified, the thumbnail size will be zero and the thumbnail image will be empty.
- Returns:
-
RawImageInfo &set_file_path(std::string file_path)#
Set the file path.
- Parameters:
file_path – Image file path.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_camera_id(std::string camera_id)#
Set the camera id.
- Parameters:
camera_id – Image camera id.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_import_time(int64_t import_time)#
Set the import time.
- Parameters:
import_time – Image import time.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_tags(Tags tags)#
Set the tags of the raw image.
- Parameters:
tags – The tags of the raw image.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_image_size(geometry::Size2f image_size)#
Set the raw image size.
Note
It’s not recommended to use this function. Use set_info_from_image() instead.
- Parameters:
image_size – The raw image size.
- Returns:
-
RawImageInfo &set_channel_and_depth(std::vector<uint32_t> channels, std::vector<visionflow::img::Image::Depth> depth)#
Set the channel and depth information of the raw image. which could be replace with set_info_from_image()
- Parameters:
channels –
depth –
- Returns:
-
RawImageInfo &set_image_fingerprint(std::string image_fingerprint)#
Set the fingerprint of the raw image.
- Parameters:
image_fingerprint – Image fingerprint.
- Returns:
-
RawImageInfo &set_thumbnail_image(visionflow::Image thumbnail_image)#
Set the thumbnail image.
- Parameters:
thumbnail_image – Thumbnail image.
- Returns:
-
const std::string &file_path() const#
-
class ViewList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
Property ViewList contains multiple visionflow::TaggedView.
Public Types
-
using Iterator = std::map<std::string, TaggedView>::iterator#
ViewList iterator.
Public Functions
-
ViewList(const ViewList &rhs)#
Deep copy constructor.
It will not share the same references as the source object.
- Parameters:
rhs – Other ViewList.
-
virtual size_t size() const override#
Get the number of visionflow::TaggedView in this ViewList.
- Returns:
size_t The number of visionflow::TaggedView in this ViewList.
-
virtual std::vector<std::string> keys() const override#
Get all visionflow::TaggedView IDs in this list.
- Returns:
std::vector<std::string> The IDs of all visionflow::TaggedView in this list.
-
virtual const TaggedView &at(const std::string &view_key) const override#
Get the visionflow::TaggedView at the given view ID.
- Parameters:
view_key – The ID of the visionflow::TaggedView.
- Returns:
const TaggedView& The visionflow::TaggedView reference at the given ID.
-
virtual bool contains(const std::string &view_key) const override#
Whether the visionflow::TaggedView with the given ID exists in this view list.
- Parameters:
view_key – The ID of the visionflow::TaggedView.
- Returns:
true The visionflow::TaggedView with the given ID exists in this list.
- Returns:
false The visionflow::TaggedView with the given ID does not exist in this list.
-
virtual void erase(const std::string &view_key) override#
Remove the visionflow::TaggedView with the given ID. Nothing will be done if the ID is not found.
- Parameters:
view_key – The ID of the visionflow::TaggedView to be removed.
-
Iterator erase(const Iterator &pos)#
Remove the visionflow::TaggedView the Iterator referenced and return iterator to the next.
- Parameters:
pos – The Iterator of the visionflow::TaggedView to be removed.
- Returns:
The Iterator to the visionflow::TaggedView follows the removed view.
-
std::string add(TaggedView view)#
Add a new visionflow::TaggedView instance into this list. An new id will be generated for the view added.
- Parameters:
view – The visionflow::TaggedView to be added into this list.
- Returns:
std::string The view id generated by the list.
-
bool add(const Iterator &it)#
Add a new visionflow::TaggedView into this list. If the ID already exists, fail to add and return false.
- Parameters:
it – The Iterator of the visionflow::TaggedView to be added.
- Returns:
true If added successfully.
- Returns:
false If failed to add.
-
void update(const std::string &view_key, TaggedView new_view)#
Update visionflow::TaggedView specified by view_key with the new view. If view specified by view_key does not exist, the new visionflow::TaggedView instance new_view will be added into this list with key view_key.
- Parameters:
view_key – The key of the view to be updated.
new_view – The new visionflow::TaggedView to be updated.
-
Iterator find(const std::string &view_key)#
Get iterator to visionflow::TaggedView with id view_key.
- Parameters:
view_key – The id to be searched for.
- Returns:
Iterator The iterator to the visionflow::TaggedView with id view_key or The iterator to map::end if not found.
-
Iterator begin() const#
Get iterator pointing to the first element.
If the ViewList is empty, the returned iterator will be equal to end().
- Returns:
NO_DISCARD iterator pointing to the first element.
-
Iterator end() const#
Get iterator pointing to the element following the last element of ViewList.
This element acts as a placeholder. Attempting to access it results in undefined behavior.
- Returns:
NO_DISCARD iterator pointing to the element following the last element of ViewList.
-
ViewList tagged_views(visionflow::SplitTag split_tag) const#
Get the specified split tag ViewList.
- Parameters:
split_tag – visionflow::SplitTag split tag.
- Returns:
NO_DISCARD the specified split tag ViewList
-
std::vector<visionflow::View> views() const#
Get the visionflow::View corresponding to each visionflow::TaggedView.
- Returns:
NO_DISCARD the visionflow::View corresponding to each visionflow::TaggedView.
-
using Iterator = std::map<std::string, TaggedView>::iterator#
-
class TaggedPolygonList : public virtual visionflow::props::IProperty#
Property TaggedPolygonList contains multiple visionflow::TaggedPolygon.
Public Types
-
using Iterator = std::map<std::string, TaggedPolygon>::iterator#
TaggedPolygonList iterator.
Public Functions
-
~TaggedPolygonList() override#
Destructor of the TaggedPolygonList.
-
size_t size() const#
Get the number of visionflow::TaggedPolygon in this TaggedPolygonList.
- Returns:
size_t The number of visionflow::TaggedPolygon in this TaggedPolygonList.
-
bool empty() const#
Check whether the TaggedPolygonList is empty.
- Returns:
NO_DISCARD True if empty, false if not empty.
-
std::vector<std::string> keys() const#
Get all visionflow::TaggedPolygon keys in this TaggedPolygonList.
- Returns:
std::vector<std::string> The keys of all visionflow::TaggedPolygon in this TaggedPolygonList.
-
TaggedPolygon &at(const std::string ®ion_key) const#
Get the visionflow::TaggedPolygon at the given view ID.
- Parameters:
region_key – The key of the visionflow::TaggedPolygon.
- Returns:
const TaggedPolygon& The visionflow::TaggedPolygon reference at the given key.
-
bool contains(const std::string ®ion_key) const#
Check whether the visionflow::TaggedPolygon with the given key exists in this TaggedPolygonList.
- Parameters:
region_key – The key of the visionflow::TaggedPolygon.
- Returns:
True if exists, false if not exists.
-
std::string add(TaggedPolygon new_region)#
Add a new visionflow::TaggedPolygon instance with a new generated key into the TaggedPolygonList.
- Parameters:
new_region – The visionflow::TaggedPolygon to be added into the TaggedPolygonList.
- Returns:
std::string The new generated key of the added TaggedPolygon.
-
void erase(const std::string ®ion_key)#
Remove the visionflow::TaggedPolygon with the given key. Nothing will be done if the key not exists.
- Parameters:
region_key – The key of the visionflow::TaggedPolygon to be removed.
-
void update(const std::string ®ion_key, TaggedPolygon new_region)#
Update visionflow::TaggedPolygon specified by region_key. If the region_key does not exist, the new visionflow::TaggedPolygon instance will be added into the TaggedPolygonList with key region_key.
- Parameters:
region_key – The key of the view to be updated.
new_region – The new visionflow::TaggedPolygon to be updated.
-
TaggedPolygonList tagged_polygons(visionflow::SplitTag split_tag) const#
Get the TaggedPolygonList with specified split_tag.
- Parameters:
split_tag – The split tag.
- Returns:
TaggedPolygonList of all visionflow::TaggedPolygon with split_tag.
-
std::vector<geometry::Polygon2f> polygons() const#
Get the geometry::Polygon2f corresponding to each visionflow::TaggedPolygon.
- Returns:
NO_DISCARD the vector of geometry::Polygon2f.
-
Iterator begin() const#
Get iterator points to the first element of TaggedPolygonList.
Note
If the TaggedPolygonList is empty, the behavior is same as end().
- Returns:
The iterator points to the first element.
-
Iterator end() const#
Get iterator points to the element following the last element of TaggedPolygonList.
- Returns:
The iterator points to the element following the last element of TaggedPolygonList.
-
Iterator find(const std::string ®ion_key)#
Get iterator to visionflow::TaggedPolygon with id region_key.
- Parameters:
region_key – The id to be searched for.
- Returns:
Iterator The iterator points to the visionflow::TaggedPolygon with id region_key or The iterator to map::end if not found.
Public Static Functions
-
static TaggedPolygonList FromViewList(const ViewList &views)#
Construct a TaggedPolygonList object from a ViewList with the split_tag, tags and the region on raw image of the each TaggedView attached or represent.
- Parameters:
views – The ViewList used to convert to the TaggedPolygonList.
- Returns:
-
using Iterator = std::map<std::string, TaggedPolygon>::iterator#
-
struct IRegionList : public virtual visionflow::props::IProperty#
IRegionList Interface to represent a list of regions.
Each region in the list has it’s own unique id with which the region can be identified.
Subclassed by visionflow::props::GaugeRegionList, visionflow::props::IDReaderRegionList, visionflow::props::MultiNamesPolygonRegionList, visionflow::props::PolygonRegionList, visionflow::props::PolygonWithStringMapRegionList, visionflow::props::RotateRectRegionList, visionflow::props::ViewList
Public Functions
-
virtual size_t size() const = 0#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
inline bool empty() const#
If the region list is empty or not.
- Returns:
true If the region list is empty.
- Returns:
false If the region list is not empty.
-
virtual std::vector<std::string> keys() const = 0#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const IRegion &at(const std::string ®ion_key) const = 0#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const = 0#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) = 0#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
virtual void draw_on(visionflow::img::Image &image, const DrawOptions &options) const#
Draw all regions on given image. Calls visionflow::IRegion::draw_on for each region in the same order as given by keys.
- Parameters:
image – The image to draw on.
options – The options to control drawing behavior.
-
void draw_on(visionflow::img::Image &image) const#
Draw all regions on given image. Calls visionflow::IRegion::draw_on for each region in the same order as given by keys.
- Parameters:
image – The image to draw on.
-
virtual size_t size() const = 0#
-
class PolygonRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
PolygonRegionList Class to store list of PolygonRegion. Generally used as segmentation label.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const PolygonRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(PolygonRegion region)#
Add a new PolygonRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, PolygonRegion new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new PolygonRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class MultiNamesPolygonRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
MultiNamesPolygonRegionList Class to store list of MultiNamesPolygonRegion. Generally used as segmentation label.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const MultiNamesPolygonRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(MultiNamesPolygonRegion region)#
Add a new MultiNamesPolygonRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, MultiNamesPolygonRegion new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new MultiNamesPolygonRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class IDReaderRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
IDReaderRegionList Class to store list of IDReaderRegion. Generally used as idreader output.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const IDReaderRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(IDReaderRegion region)#
Add a new IDReaderRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, IDReaderRegion new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new IDReaderRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class PolygonWithStringMapRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
PolygonWithStringMapRegionList Class to store list of PolygonWithStringMapRegion. Generally used as segmentation label.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const PolygonWithStringMapRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(PolygonWithStringMapRegion region)#
Add a new PolygonWithStringMapRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, PolygonWithStringMapRegion new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new PolygonWithStringMapRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class RotateRectRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
List of RotateRect regions.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const RotateRectRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(RotateRectRegion region)#
Add a new RotateRectRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, RotateRectRegion new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new RotateRectRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
virtual size_t size() const override#
-
class GaugeRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const GaugeRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(GaugeRegion region)#
Add a new GaugeRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, GaugeRegion new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new GaugeRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class FeatureMap : public visionflow::props::IProperty#
FeatureMap is a data structure used to store feature maps detected by each algorithm module. A FeatureMap stores a single-channel floating-point grayscale image for each label class according to the label class name of the detected target. It’s recommended that the value of the grayscale image is between 0 and 1.
Public Functions
-
void insert(const std::string &label_class, visionflow::SubImage feature_map)#
Insert feature map with label class name, multiple feature map with same class will be exist in the container if this function be called multiple times with same label_class name.
Note
The data of the image in the visionflow::SubImage will not be copied, which means that if you modify the data content in the image later, the data of the image in the inserted sub-image will also be modified. If this is not the behavior you expect, you can call visionflow::SubImage::clone() explicitly like below:
feature_map.insert("label-class", sub_image.clone());
- Parameters:
label_class – The label class name of the feature map.
feature_map – The feature map, which should be a single-channel floating-point grayscale image, and it’s recommended that the value of the grayscale image is between 0 and 1.
- Throws:
visionflow::excepts::InvalidArgument – if the feature map is not a single-channel floating-point grayscale image.
-
void set(const std::string &label_class, std::vector<visionflow::SubImage> feature_maps)#
Insert feature map with label class name, and the old feature maps will be replaced.
See also
insert(const std::string &label_class, const visionflow::SubImage
&feature_map)
Note
The data of the image in the visionflow::SubImage will not be copied, which means that if you modify the data content in the image later, the data of the image in the inserted sub-image will also be modified.
- Parameters:
label_class – The label class name of the feature maps.
feature_maps – The feature map list, each sub-image in which should be a single-channel floating-point grayscale image, and it’s recommended that the value of the grayscale image is between 0 and 1.
- Throws:
visionflow::excepts::InvalidArgument – if any one of feature map in the list is not a single-channel floating-point grayscale image.
-
void remove(const std::string &label_class)#
Remove feature map specified by the label class name. Do nothing if the class name not found.
- Parameters:
label_class – The key of the feature map to be removed.
-
bool contains(const std::string &label_class) const#
Check if the feature map exists in the container.
- Parameters:
label_class – The class name of the feature map
- Returns:
True if exists. Else false.
-
const std::vector<visionflow::SubImage> &get(const std::string &label_class) const#
Get the feature map specified by the name.
Note
Do not modify the data of the image in the visionflow::SubImage without clone, insert(const std::string &label_class,visionflow::SubImage feature_map) for more details.
- Parameters:
label_class –
- Returns:
const std::vector<visionflow::SubImage> & The const reference of the feature maps.
-
std::vector<visionflow::SubImage> &get(const std::string &label_class)#
Get the feature map specified by the name.
- Parameters:
label_class –
- Returns:
std::vector<visionflow::SubImage> & The reference of the feature maps.
-
std::vector<std::string> keys() const#
Get all class names of all feature maps.
- Returns:
std::vector<std::string> The class names list.
-
void clear()#
Clear the feats container.
-
void set_pixel_class_names(std::vector<std::string> pixel_class_names)#
Set the class names. The index of the class name in the vector is mapped to the pixel value.
- Parameters:
pixel_class_names –
-
const std::vector<std::string> &get_pixel_class_names() const#
get the pixel class names.
-
void clear_pixel_classes()#
clear the pixel classes and names.
-
void insert(const std::string &label_class, visionflow::SubImage feature_map)#
-
enum visionflow::props::MatchResult#
Values:
-
enumerator kTpOrTn = 0#
-
enumerator kFn = 1#
-
enumerator kFp = 2#
-
enumerator kFnAndFp = 3#
-
enumerator kUnknown = 4#
-
enumerator kTpOrTn = 0#
-
class RegionMatchResultList : public visionflow::props::IProperty#
Property to store list of RegionMatchResult.
Public Functions
-
void set_truth_best_match(const std::string &truth_key, std::string prediction_key)#
Set the best match of the truth.
- Parameters:
truth_key – The key of the truth.
prediction_key – The key of the prediction.
-
void set_prediction_best_match(const std::string &prediction_key, std::string truth_key)#
Set the best match of the prediction.
- Parameters:
prediction_key – The key of the prediction.
truth_key – The key of the truth.
-
void set_view_match_result(const std::string &view_key, MatchResult match_result)#
Set the view match result.
- Parameters:
view_key – The key of the view.
match_result – The MatchResult of the view.
-
std::vector<std::string> truth_keys() const#
Get all ground truth keys.
- Returns:
NO_DISCARD
-
std::vector<std::string> prediction_keys() const#
Get all prediction keys.
- Returns:
NO_DISCARD
-
std::string truth_best_match(const std::string &truth_key) const#
Get the best match with truth key.
- Parameters:
truth_key – The key of the truth.
- Throws:
excepts::DataNotFound – If the truth key does’t exist.
- Returns:
NO_DISCARD
-
std::string prediction_best_match(const std::string &prediction_key) const#
Get the best match with prediction key.
- Parameters:
prediction_key – The key of the prediction.
- Throws:
excepts::DataNotFound – If the prediction key does’t exist.
- Returns:
NO_DISCARD
-
bool is_mutual_best_match(const std::string &truth_key, const std::string &prediction_key) const#
Determine whether truth_key and prediction_key are the best match for each other.
- Parameters:
truth_key – The key of the truth.
prediction_key – The key of the prediction.
- Throws:
excepts::DataNotFound – If the truth key or the prediction key does’t exist.
- Returns:
NO_DISCARD
-
MatchResult view_match_result(const std::string &view_key) const#
Get the match result of the view with the key.
- Parameters:
view_key – The key of the view.
- Throws:
excepts::DataNotFound – If the view key does’t exist.
- Returns:
NO_DISCARD
-
MatchResult match_result() const#
Get the match result of the sample.
- Returns:
NO_DISCARD
-
void set_truth_best_match(const std::string &truth_key, std::string prediction_key)#
-
class StringMessage : public visionflow::props::IProperty#
A property class that holds a string.
Public Functions
-
const std::string &get() const#
Get the result of the integration classifier.
- Returns:
NO_DISCARD
-
void set(std::string message)#
Set the result of the integration classifier.
- Parameters:
message –
-
const std::map<std::string, std::string> &get_extension_data() const#
Get the extension data including custom output messages in the script.
- Returns:
NO_DISCARD
-
void set_extension_data(std::map<std::string, std::string> extension_data)#
Set the extension data.
- Parameters:
extension_data –
-
const std::string &get() const#
Property Base Types#
-
class View#
View after matrix transformation.
Subclassed by visionflow::TaggedView
Public Functions
-
View(geometry::Matrix3f mat, geometry::Size2f size)#
Constructor with transformation matrix and transformed View size.
- Parameters:
mat – Transformation matrix.
size – View size.
-
View(const View &rhs)#
Deep copy constructor.
It will not share the same references as the source object.
- Parameters:
rhs – Other View.
-
View &operator=(const View &rhs)#
Assignment operator.
It will not share the same references as the source object.
-
geometry::Ring2f view_on_raw_image() const#
Ring on raw image before View transformation.
- Returns:
NO_DISCARD geometry::Ring2f the result is Ring.
-
const geometry::Matrix3f &transform_matrix() const#
Get transformation matrix.
- Returns:
NO_DISCARD const geometry::Matrix3f& transformation matrix.
-
const geometry::Size2f &size() const#
Get transformed View size.
- Returns:
NO_DISCARD const geometry::Size2f& View size.
-
View(geometry::Matrix3f mat, geometry::Size2f size)#
-
enum visionflow::SplitTag#
Split tag for the TaggedView and TaggedPolygon.
Values:
-
enumerator kUnknown = 0#
Undivided set.
-
enumerator kTrain = 1#
Training set.
-
enumerator kTest = 2#
Test set.
-
enumerator kUnknown = 0#
-
class Tags#
Tags Manager. The Tags Manager supports two types of tags: value-tag and grouped-tag.
The value-tag is a string with any characters but should not contains “:=”, You can add any number of unique value-tags into a Tags Manager.
The grouped-tag is a string format like “<GROUP>:=<VALUE>”, the
GROUPis the group name, and theVALUEis the value of this group. The Tags Manager will only keep one value for each unique group. For example, All tags start with “date:=” will be remove from the Tags Manager when you add “date:=2021:12:31” into the Tags Manager.Public Functions
-
Tags &add(const std::string &tag)#
Add tag string to tag some object.
- Parameters:
tag – The tag string to be add, which should not be empty, otherwise it will be ignored and warning log will be print. In particular, if a tag string is formatted like “<GROUP>:=<VALUE>” (e.g. “date:=2021-12-31”), it will be recognized as a grouped-tag.
-
Tags &remove(const std::string &tag)#
Remove tag from the manager.
- Parameters:
tag – The tag to be removed. If it’s formatted like “<GROUP>:=”, the grouped-tag “GROUP” will be removed.
-
const std::string &at(const std::string &group) const#
Get the value of the tag with the group name.
- Parameters:
group – The group name. e.g. “date:=”
- Throws:
visionflow::excepts::DataNotFound – If the group name is not found.
- Returns:
const std::string& The value of the tag. If the tag is not found, an exception will be thrown.
-
bool contains(const std::string &tag) const#
Check if the manager contains the specific tag.
- Parameters:
tag – The specific tag. If it’s formatted like “<GROUP>:=”, The result represent that if the group exists in the manager.
- Returns:
true
- Returns:
false
-
size_t size() const#
Get number of tags in the manager.
- Returns:
size_t The number of tags in the manager.
-
std::vector<std::string> all(bool hide_group_tags = false) const#
Get all tags in the manager.
- Parameters:
hide_group_tags – Whether hide group-tags or not. Default is not hide.
- Returns:
std::vector<std::string> The vector of tags.
-
std::vector<std::string> search(const std::string ®ex) const#
Search all tags matching the given regular expression.
- Parameters:
regex – The regular expression.
- Throws:
visionflow::excepts::InvalidArgument – Maybe the regex is invalid.
- Returns:
std::vector<std::string> Tags match with the regular expression
-
Tags &add(const std::string &tag)#
-
class TaggedView : public visionflow::IRegion, public visionflow::View#
View with split tag.
Public Functions
-
TaggedView()#
Construct a new TaggedView object by default.
-
explicit TaggedView(const View &view, SplitTag split_tag = kUnknown)#
Constructor with View and SplitTag.
- Parameters:
view – View.
split_tag – SplitTag. Default is kUnknown, which means undivided set.
-
TaggedView(const TaggedView &rhs)#
Deep copy constructor.
It will not share the same references as the source object.
- Parameters:
rhs – Other TaggedView.
-
TaggedView &operator=(const TaggedView &rhs)#
Assignment operator.
It will not share the same references as the source object.
- Parameters:
rhs – Other TaggedView.
- Returns:
TaggedView& reference to this object.
-
TaggedView(TaggedView &&rhs) noexcept#
Move constructor.
- Parameters:
rhs – Other rvalue TaggedView.
-
TaggedView &operator=(TaggedView &&rhs) noexcept#
Move assignment operator.
- Parameters:
rhs – Other rvalue TaggedView.
- Returns:
TaggedView& reference to this object.
-
virtual std::shared_ptr<IRegion> clone() const override#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
virtual geometry::Polygon2f polygon() const override#
Get the polygon of the raw image before View transformation.
Note
Same as View::view_on_raw_image().
- Returns:
geometry::Polygon2f The polygon of the raw image before View transformation.
-
virtual geometry::Ring2f bounding_ring() const override#
Get the outer_boundary of the raw image before View transformation.
Note
Same as View::view_on_raw_image().
- Returns:
geometry::Ring2f The outer_boundary of the raw image before View transformation.
-
TaggedView &set_split_tag(SplitTag split_tag)#
Set the split tag.
- Parameters:
split_tag – SplitTag.
- Returns:
TaggedView& reference to this object.
-
TaggedView &set_tags(Tags tags)#
Set the tags.
-
const geometry::MultiPolygon2f &view_masks() const#
Get the view masks.
ViewMasks is a geometric representation of a set of masks based on the coordinates of the view window, where images and annotations at corresponding positions in the view are masked during training and inference.
- Returns:
const geometry::MultiPolygon2f& The view mask.
-
geometry::MultiPolygon2f &view_masks()#
Get the view masks.
- Returns:
geometry::MultiPolygon2f& The mutable view masks.
-
TaggedView &set_view_masks(const geometry::MultiPolygon2f &masks)#
Set the view masks.
See also
- Parameters:
masks – The view mask polygons.
- Returns:
TaggedView& The TaggedView self.
-
virtual geometry::Radian angle() const override#
Get the angle of the TaggedView back to the raw image.
- Returns:
NO_DISCARD The angle of the TaggedView back to the raw image.
-
TaggedView()#
-
class TaggedPolygon#
TaggedPolygon represents a polygon region on raw image with dataset and tags information.
Public Functions
-
TaggedPolygon()#
Default constructor.
-
const geometry::Polygon2f &polygon() const#
Get the polygon region of the TaggedPolygon.
- Returns:
geometry::Polygon2f The polygon region.
-
TaggedPolygon &set_polygon(geometry::Polygon2f poly)#
Set the polygon region to the TaggedPolygon.
- Parameters:
poly – The polygon region to be set.
- Returns:
TaggedPolygon& The TaggedPolygon itself.
-
SplitTag split_tag() const#
Get the SplitTag of the TaggedPolygon.
- Returns:
SplitTag
-
TaggedPolygon &set_split_tag(SplitTag split_tag)#
Set the SplitTag to TaggedPolygon.
- Parameters:
split_tag – The SplitTag to be set.
- Returns:
TaggedPolygon& The TaggedPolygon itself.
-
const Tags &tags() const#
Get the Tags of the TaggedPolygon.
- Returns:
-
TaggedPolygon &set_tags(Tags tags)#
Set tags to the TaggedPolygon.
- Parameters:
tags –
- Returns:
TaggedPolygon& The TaggedPolygon itself.
Public Static Functions
-
static TaggedPolygon FromTaggedView(const TaggedView &tagged_view)#
Construct a TaggedPolygon from a TaggedView with the split_tag, tags and the region on raw image the TaggedView attached or represent.
- Parameters:
tagged_view – The visionflow::TaggedView used to convert to a TaggedPolygon.
- Returns:
-
TaggedPolygon()#
-
class IRegion#
IRegion is an interface to represent a region in the coordinate system. Each region is defined by a ring and a name string.
Subclassed by visionflow::PolygonRegion, visionflow::RotateRectRegion, visionflow::TaggedView
Public Functions
-
virtual std::shared_ptr<IRegion> clone() const = 0#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
virtual geometry::Polygon2f polygon() const = 0#
Interface to get polygon of the region.
- Returns:
geometry::Polygon2f the polygon representing this region.
-
inline virtual geometry::Ring2f bounding_ring() const#
Interface to get the outer_boundary of this region.
- Returns:
geometry::Ring2f The outer_boundary of this region.
-
virtual IRegion &set_name(std::string name)#
Set the name of this region.
- Parameters:
name – The new name of this region.
- Returns:
IRegion& This region.
-
virtual std::string name() const#
Interface to get name of this region.
- Returns:
std::string
-
virtual float score() const#
Interface to get score of this region.
Default implementation returns 1.0F, Developers can override this method to return the score of the region in their own way. But it’s recommended that the score should be in [0, 1].
- Returns:
float The score of this region.
-
inline virtual geometry::Radian angle() const#
Interface to get rotate angle of this region.
- Returns:
geometry::Radian The angle of this region.
-
inline virtual float area() const#
Get the area of this region.
Default implementation returns the area of the polygon(). Developers can override this method to return the area of the region in their own way.
- Returns:
float The area of this region.
-
virtual void draw_on(visionflow::img::Image &image, const DrawOptions &options) const#
Draw this region on given image.
Three items will be drawn: 1. the polygon of the region get by polygon(); 2. the bounding box of the region polygon get by visionflow::geometry::Polygon2f::bounding_box(); 3. the name and score of the region, concatenated by a colon.
- Parameters:
image – The image to draw on.
options – The options to control drawing behavior.
-
void draw_on(visionflow::img::Image &image) const#
Draw this region on given image.
Three items will be drawn: 1. the polygon of the region get by polygon(); 2. the bounding box of the region polygon get by visionflow::geometry::Polygon2f::bounding_box(); 3. the name and score of the region, concatenated by a colon.
- Parameters:
image – The image to draw on.
-
virtual std::shared_ptr<IRegion> clone() const = 0#
-
class PolygonRegion : public visionflow::IRegion#
Label Region described with polygon, generally used for segmentation.
Subclassed by visionflow::GaugeRegion, visionflow::IDReaderRegion, visionflow::MultiNamesPolygonRegion, visionflow::PolygonWithStringMapRegion
Public Functions
-
virtual std::shared_ptr<IRegion> clone() const override#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
PolygonRegion &set_polygon(geometry::Polygon2f polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
PolygonRegion& This region.
-
virtual geometry::Polygon2f polygon() const override#
Get the Polygon of segmentation region.
- Returns:
geometry::Polygon2f The Polygon of segmentation region.
-
inline virtual PolygonRegion &set_name(std::string name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
PolygonRegion& This region.
-
inline virtual PolygonRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
PolygonRegion& This region.
-
PolygonRegion &set_angle(geometry::Radian angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
PolygonRegion& This region.
-
virtual geometry::Radian angle() const override#
Interface to get the rotate_angle of this region.
- Returns:
geometry::Radian The rotate_angle of this region.
-
virtual geometry::Ring2f bounding_ring() const override#
Interface to get the outer_boundary of this region.
- Returns:
geometry::Ring2f The outer_boundary of this region.
-
virtual float area() const override#
Get the area of this region.
- Returns:
float The area of this region.
-
virtual std::shared_ptr<IRegion> clone() const override#
-
class MultiNamesPolygonRegion : public visionflow::PolygonRegion#
Label Region described with polygon and names, generally used for classification.
Public Functions
-
inline MultiNamesPolygonRegion &set_polygon(geometry::Polygon2f polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
MultiNamesPolygonRegion This region.
-
inline virtual MultiNamesPolygonRegion &set_name(std::string name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
MultiNamesPolygonRegion& This region.
-
inline virtual MultiNamesPolygonRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
PolygonRegionNames& This region.
-
inline MultiNamesPolygonRegion &set_angle(geometry::Radian angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
MultiNamesPolygonRegion& This region.
-
MultiNamesPolygonRegion &set_name_scores(std::map<std::string, float> name_scores)#
Set the names and scores from softmax of this region.
- Parameters:
name_scores – The names and scores to be set.
- Returns:
MultiNamesPolygonRegion& This region.
-
std::map<std::string, float> name_scores() const#
Interface to get the names and scores from softmax of this region.
- Returns:
std::map<std::string, float> the names and scores from softmax of this region.
-
MultiNamesPolygonRegion &set_logic_scores(std::map<std::string, float> logic_scores)#
Set the names and scores from fc layer of this region.
- Parameters:
logic_scores – The names and scores to be set.
- Returns:
MultiNamesPolygonRegion& This region.
-
std::map<std::string, float> logic_scores() const#
Interface to get names and scores from fc layer of this region.
- Returns:
std::map<std::string, float> names and scores from fc layer of this region.
-
inline MultiNamesPolygonRegion &set_polygon(geometry::Polygon2f polygon)#
-
class PolygonWithStringMapRegion : public visionflow::PolygonRegion#
Label Region described with polygon and names, generally used for classification.
Public Functions
-
inline PolygonWithStringMapRegion &set_polygon(geometry::Polygon2f polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
PolygonWithStringMapRegion& This region.
-
inline virtual PolygonWithStringMapRegion &set_name(std::string name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
PolygonWithStringMapRegion& This region.
-
inline virtual PolygonWithStringMapRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
PolygonRegionNames& This region.
-
inline PolygonWithStringMapRegion &set_angle(geometry::Radian angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
PolygonWithStringMapRegion& This region.
-
PolygonWithStringMapRegion &set_additional_map(std::map<std::string, std::string> additional_map)#
Set the additional map.
- Parameters:
additional_map – The map to be set.
- Returns:
PolygonWithStringMapRegion& This region.
-
std::map<std::string, std::string> additional_map() const#
Interface to get the additional map.
- Returns:
std::map<std::string, std::string> the additional map.
-
inline PolygonWithStringMapRegion &set_polygon(geometry::Polygon2f polygon)#
-
class RotateRectRegion : public visionflow::IRegion#
RotateRectRegion is a region type used to describe an rectangle region with direction.
Public Functions
-
virtual std::shared_ptr<IRegion> clone() const override#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
RotateRectRegion &set_rotate_rect(geometry::RotateRect2f rrect)#
Set the rotate rect object.
- Parameters:
rrect –
- Returns:
RotateRectRegion& this region.
-
const geometry::RotateRect2f &rotate_rect() const#
Get the rotate rectangle.
- Returns:
geometry::RotateRect2f const&
-
virtual geometry::Polygon2f polygon() const override#
Get the Polygon of segmentation region.
- Returns:
geometry::Polygon2f The Polygon of segmentation region.
-
inline virtual RotateRectRegion &set_name(std::string name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
RotateRectRegion& This region.
-
inline virtual RotateRectRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
RotateRectRegion& This region.
-
virtual geometry::Ring2f bounding_ring() const override#
Interface to get the outer_boundary of this region.
- Returns:
geometry::Ring2f The outer_boundary of this region.
-
virtual geometry::Radian angle() const override#
Interface to get the rotate_angle of this region.
- Returns:
geometry::Radian The rotate_angle of this region.
-
virtual float area() const override#
Get the area of this region.
- Returns:
float The area of this region.
-
virtual std::shared_ptr<IRegion> clone() const override#
-
class IDReaderRegion : public visionflow::PolygonRegion#
IDReader Region described with polygon, name and type, generally used for idreader.
Public Functions
-
inline IDReaderRegion &set_polygon(geometry::Polygon2f polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
IDReaderRegion& This region.
-
inline virtual IDReaderRegion &set_name(std::string name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
IDReaderRegion& This region.
-
inline virtual IDReaderRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
IDReaderRegion& This region.
-
inline IDReaderRegion &set_angle(geometry::Radian angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
IDReaderRegion& This region.
-
IDReaderRegion &set_idreader_type(IDReaderType idreader_type)#
Set the idreader type of this region.
- Parameters:
idreader_type – The idreader type to be set.
- Returns:
IDReaderRegion& This region.
-
IDReaderType idreader_type() const#
Interface to get the idreader type from this region.
- Returns:
IDReaderType the idreader type from this region.
-
inline IDReaderRegion &set_polygon(geometry::Polygon2f polygon)#
-
enum visionflow::IDReaderType#
Values:
-
enumerator kNone = 0#
-
enumerator kCode128 = 1#
-
enumerator kCode39 = 2#
-
enumerator kCode93 = 3#
-
enumerator kEAN13 = 4#
-
enumerator kEAN8 = 5#
-
enumerator kUPCA = 6#
-
enumerator kUPCE = 7#
-
enumerator kDM = 8#
-
enumerator kQR = 9#
-
enumerator kQRCM1 = 10#
-
enumerator kQRCM2 = 11#
-
enumerator kMicroQRC = 12#
-
enumerator kNone = 0#
-
class GaugeRegion : public visionflow::PolygonRegion#
The gauge region object.
Public Functions
-
virtual std::shared_ptr<IRegion> clone() const override#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
inline GaugeRegion &set_polygon(geometry::Polygon2f polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
GaugeRegion& This region.
-
inline virtual GaugeRegion &set_name(std::string name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
GaugeRegion& This region.
-
inline virtual GaugeRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
GaugeRegion& This region.
-
inline GaugeRegion &set_angle(geometry::Radian angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
GaugeRegion& This region.
-
std::string add_element_point(geometry::Point2f point)#
Add a point.
- Parameters:
point – the point object to be save into the property.
- Returns:
std::string The point name.
-
GaugeRegion &set_element_point(std::string name, geometry::Point2f point)#
Set the point with name. Note that the old point will be replaced if the point with the same name exists.
- Parameters:
name – The name of the point.
point – the point object to be save into the region.
- Returns:
GaugeRegion& This region.
-
bool erase_element_point(const std::string &name)#
Remove the point with the given name.
- Parameters:
name – The point name to be removed.
- Returns:
true if the point exists and removed successfully.
- Returns:
false if the point does not exist.
-
std::vector<std::string> element_point_names() const#
Get all the point names.
- Returns:
std::vector<std::string> point names.
-
size_t element_point_size() const#
Get the number of points.
- Returns:
size_t The number of points.
-
bool contains_element_point(const std::string &name) const#
Check if the region contains a point with the given name.
- Parameters:
name – The name of the point.
- Returns:
bool True if the region contains the point, false otherwise.
-
const geometry::Point2f &get_element_point(const std::string &name) const#
Get the point object. An error will be thrown if the point does not exist. You can use contains_point() to check if the point exists.
- Parameters:
name – The name of the point.
- Throws:
excepts::DataNotFound – If the point does not exist.
- Returns:
const geometry::Point2f& The point object.
-
std::string add_element_circle(geometry::Circle2f circle)#
Add a circle.
- Parameters:
circle – the circle object to be save into the property.
- Returns:
std::string The circle name.
-
GaugeRegion &set_element_circle(std::string name, geometry::Circle2f circle)#
Set the circle with name. Note that the old circle will be replaced if the circle with the same name exists.
- Parameters:
name – The name of the circle.
circle – the circle object to be save into the region.
- Returns:
GaugeRegion& This region.
-
bool erase_element_circle(const std::string &name)#
Remove the circle with the given name.
- Parameters:
name – The circle name to be removed.
- Returns:
true if the circle exists and removed successfully.
- Returns:
false if the circle does not exist.
-
std::vector<std::string> element_circle_names() const#
Get all the circle names.
- Returns:
std::vector<std::string> circle names.
-
size_t element_circle_size() const#
Get the number of circles.
- Returns:
size_t The number of circles.
-
bool contains_element_circle(const std::string &name) const#
Check if the region contains a circle with the given name.
- Parameters:
name – The name of the circle.
- Returns:
bool True if the region contains the circle, false otherwise.
-
const geometry::Circle2f &get_element_circle(const std::string &name) const#
Get the circle object. An error will be thrown if the circle does not exist. You can use contains_circle() to check if the circle exists.
- Parameters:
name – The name of the circle.
- Throws:
excepts::DataNotFound – If the circle does not exist.
- Returns:
const geometry::Circle2f& The circle object.
-
std::string add_element_segment(geometry::Segment2f segment)#
Add a segment.
- Parameters:
segment – the segment object to be save into the property.
- Returns:
std::string The segment name.
-
GaugeRegion &set_element_segment(std::string name, geometry::Segment2f segment)#
Set the segment with name. Note that the old segment will be replaced if the segment with the same name exists.
- Parameters:
name – The name of the segment.
segment – the segment object to be save into the region.
- Returns:
GaugeRegion& This region.
-
bool erase_element_segment(const std::string &name)#
Remove the segment with the given name.
- Parameters:
name – The segment name to be removed.
- Returns:
true if the segment exists and removed successfully.
- Returns:
false if the segment does not exist.
-
std::vector<std::string> element_segment_names() const#
Get all the segment names.
- Returns:
std::vector<std::string> segment names.
-
size_t element_segment_size() const#
Get the number of segments.
- Returns:
size_t The number of segments.
-
bool contains_element_segment(const std::string &name) const#
Check if the region contains a segment with the given name.
- Parameters:
name – The name of the segment.
- Returns:
bool True if the region contains the segment, false otherwise.
-
const geometry::Segment2f &get_element_segment(const std::string &name) const#
Get the segment object. An error will be thrown if the segment does not exist. You can use contains_segment() to check if the segment exists.
- Parameters:
name – The name of the segment.
- Throws:
excepts::DataNotFound – If the segment does not exist.
- Returns:
const geometry::Segment2f& The segment object.
-
std::string add_element_number(double number)#
Add a number.
- Parameters:
number – the number object to be save into the property.
- Returns:
std::string The number name.
-
GaugeRegion &set_element_number(std::string name, double number)#
Set the number with name. Note that the old number will be replaced if the number with the same name exists.
- Parameters:
name – The name of the number.
number – the number object to be save into the region.
- Returns:
GaugeRegion& This region.
-
bool erase_element_number(const std::string &name)#
Remove the number with the given name.
- Parameters:
name – The number name to be removed.
- Returns:
true if the number exists and removed successfully.
- Returns:
false if the number does not exist.
-
std::vector<std::string> element_number_names() const#
Get all the number names.
- Returns:
std::vector<std::string> number names.
-
size_t element_number_size() const#
Get the number of numbers.
- Returns:
size_t The number of numbers.
-
bool contains_element_number(const std::string &name) const#
Check if the region contains a number with the given name.
- Parameters:
name – The name of the number.
- Returns:
bool True if the region contains the number, false otherwise.
-
const double &get_element_number(const std::string &name) const#
Get the number object. An error will be thrown if the number does not exist. You can use contains_number() to check if the number exists.
- Parameters:
name – The name of the number.
- Throws:
excepts::DataNotFound – If the number does not exist.
- Returns:
const double& The number object.
-
std::string add_element_string(std::string string)#
Add a string.
- Parameters:
string – the string object to be save into the property.
- Returns:
std::string The string name.
-
GaugeRegion &set_element_string(std::string name, std::string string)#
Set the string with name. Note that the old string will be replaced if the string with the same name exists.
- Parameters:
name – The name of the string.
string – the string object to be save into the region.
- Returns:
GaugeRegion& This region.
-
bool erase_element_string(const std::string &name)#
Remove the string with the given name.
- Parameters:
name – The string name to be removed.
- Returns:
true if the string exists and removed successfully.
- Returns:
false if the string does not exist.
-
std::vector<std::string> element_string_names() const#
Get all the string names.
- Returns:
std::vector<std::string> string names.
-
size_t element_string_size() const#
Get the number of strings.
- Returns:
size_t The number of strings.
-
bool contains_element_string(const std::string &name) const#
Check if the region contains a string with the given name.
- Parameters:
name – The name of the string.
- Returns:
bool True if the region contains the string, false otherwise.
-
const std::string &get_element_string(const std::string &name) const#
Get the string object. An error will be thrown if the string does not exist. You can use contains_string() to check if the string exists.
- Parameters:
name – The name of the string.
- Throws:
excepts::DataNotFound – If the string does not exist.
- Returns:
const std::string& The string object.
-
virtual std::shared_ptr<IRegion> clone() const override#
Drawing Properties on Image#
-
struct DrawOptions#
The options for drawing an IRegion object on an image. See the parameters of visionflow::img::draw for details about each field.
Public Members
-
std::vector<int> color#
The color used to draw, leave empty to use a random preset color.
-
int line_thickness = 0#
The thickness of the line, leave at 0 to auto determine.
-
uint32_t font_height_pixel = 0#
The font size in pixel, leave at 0 to auto determine.
-
std::string font_name#
The font name, leave empty to use default font.
-
std::vector<int> color#