JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
|
Share this page: |
|
|
|
|
|
|
Go to the documentation of this file.
21 #include <opencv2/core/core.hpp>
26 #include <ovxlib/vsi_nn_pub.h>
32 class PreProcessorForPython;
34 namespace preprocessor
46 "or 0.0 to extract an unscaled UINT8 blob, typically for use with quantized networks",
47 2.0
F / 255.0
F, ParamCateg);
51 "order as the network's input",
52 cv::Scalar(127.5
F, 127.5
F, 127.5
F), ParamCateg);
56 "factor are applied. This is rarely used. Same RGB/BGR order as the network's input",
57 cv::Scalar(1.0
F, 1.0
F, 1.0
F), ParamCateg);
61 "with same aspect ratio as the network's input tensor, and then rescale it to that "
62 "tensor's width and height (hence with cropping but no distortion). Otherwise, use "
63 "the whole image and rescale it to the network's input width and height with some "
64 "possible stretching.",
73 "class defined in the file must match the file name without the "
86 "from camera to network input dims",
87 InterpMode::Nearest, InterpMode_Values, ParamCateg);
91 "Any additional inputs required by the network would have to be specified using "
92 "Network parameter extraintensors",
109 public jevois::Parameter<preprocessor::rgb, preprocessor::showin, preprocessor::details>
120 virtual void freeze(
bool doit) = 0;
133 std::vector<cv::Mat>
const &
blobs()
const;
136 cv::Size
blobsize(
size_t num)
const;
141 void b2i(
float & x,
float & y,
size_t blobnum = 0);
146 void b2i(
float & x,
float & y, cv::Size
const & bsiz,
bool letterboxed);
160 void i2b(
float & x,
float & y,
size_t blobnum = 0);
166 void i2b(
float & x,
float & y, cv::Size
const & bsiz,
bool letterboxed);
175 virtual std::vector<cv::Mat>
process(cv::Mat
const & img,
bool isrgb,
176 std::vector<vsi_nn_tensor_attr_t>
const & attrs,
177 std::vector<cv::Rect> & crops) = 0;
184 std::vector<vsi_nn_tensor_attr_t> itsAttrs;
185 std::vector<cv::Mat> itsBlobs;
186 std::vector<cv::Rect> itsCrops;
188 cv::Size itsImageSize;
189 unsigned int itsImageFmt;
192 std::shared_ptr<PreProcessorForPython> itsPP;
cv::Size blobsize(size_t num) const
Access the width and height of a given blob, accounting for NCHW or NHWC.
cv::Rect getUnscaledCropRect(size_t blobnum=0)
Get unscaled crop rectangle in image coordinates.
JEVOIS_DECLARE_PARAMETER(thresh1, double, "First threshold for hysteresis", 50.0, ParamCateg)
A component of a model hierarchy.
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
const std::vector< cv::Mat > & blobs() const
Access the last computed blobs (or empty if process() has not yet been called)
A category to which multiple ParameterDef definitions can belong.
Helper class to assist modules in creating graphical and GUI elements.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(l2grad, bool, "Use more accurate L2 gradient norm if true, L1 if false", false, ParamCateg)
Pre-Processor for neural network pipeline.
virtual void freeze(bool doit)=0
Freeze/unfreeze parameters that users should not change while running.
virtual void sendreport(jevois::StdModule *mod, jevois::RawImage *outimg=nullptr, jevois::OptGUIhelper *helper=nullptr, bool overlay=true, bool idle=false)
Report what happened in last process() to console/output video/GUI.
virtual void report(jevois::StdModule *mod, jevois::RawImage *outimg=nullptr, jevois::OptGUIhelper *helper=nullptr, bool overlay=true, bool idle=false)=0
Report what happened in last process() to console/output video/GUI.
const cv::Size & imagesize() const
Access the last processed image size.
void b2i(float &x, float &y, size_t blobnum=0)
Convert coordinates from blob back to original image.
std::vector< cv::Mat > process(jevois::RawImage const &img, std::vector< vsi_nn_tensor_attr_t > const &attrs)
Extract blobs from input image.
JEVOIS_DEFINE_ENUM_CLASS(CameraSensor,(any)(imx290)(os08a10)(ar0234))
Enum for different sensor models.
void i2b(float &x, float &y, size_t blobnum=0)
Convert coordinates from image to blob.
std::shared_ptr< PreProcessorForPython > getPreProcForPy() const
Get a pointer to our python-friendly interface.
Base class for a module that supports standardized serial messages.
virtual ~PreProcessor()
Destructor.
PreProcessor(std::string const &instance)
Constructor.