A helper component for optimizing image processing in Unity by managing frame skipping and downscaling operations.
More...
A helper component for optimizing image processing in Unity by managing frame skipping and downscaling operations.
The ImageOptimizationHelper class provides utilities to enhance performance during image processing tasks. It includes features such as:
-
Downscaling images to reduce computational load
-
Skipping frames to optimize processing frequency
This class is particularly useful when working with high-resolution images or real-time processing where performance is a priority.
Attach this component to a GameObject to enable image optimization:
imageHelper.downscaleRatio = 2.0f;
imageHelper.frameSkippingRatio = 3;
{
}
n-dimensional dense array class
Definition Mat_ValueTuple.cs:11
A helper component for optimizing image processing in Unity by managing frame skipping and downscalin...
Definition ImageOptimizationHelper.cs:42
virtual Mat GetDownScaleMat(Mat originalMat)
Gets the mat that downscaled the original mat. if downscaleRatio == 1 , return originalMat.
Definition ImageOptimizationHelper.cs:111
virtual bool IsCurrentFrameSkipped()
Indicates whether the current frame is skipped.
Definition ImageOptimizationHelper.cs:92
◆ Dispose()
virtual void OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.Dispose |
( |
| ) |
|
|
virtual |
◆ GetDownScaleMat()
virtual Mat OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.GetDownScaleMat |
( |
Mat | originalMat | ) |
|
|
virtual |
Gets the mat that downscaled the original mat. if downscaleRatio == 1 , return originalMat.
Please do not dispose of the returned mat as it will be reused.
- Returns
- The downscale mat.
- Parameters
-
◆ IsCurrentFrameSkipped()
virtual bool OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.IsCurrentFrameSkipped |
( |
| ) |
|
|
virtual |
Indicates whether the current frame is skipped.
- Returns
true
, if the current frame is skipped, false
otherwise.
◆ OnDestroy()
virtual void OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.OnDestroy |
( |
| ) |
|
|
protectedvirtual |
◆ OnValidate()
virtual void OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.OnValidate |
( |
| ) |
|
|
protectedvirtual |
◆ RestoreOriginalSizeKeyPoint()
virtual KeyPoint OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeKeyPoint |
( |
KeyPoint | downscaledKeyPoint | ) |
|
|
virtual |
Restores the original size of the KeyPoint based on the downscale ratio.
- Parameters
-
downscaledPoint | The detected keyooint in the downscaled image. |
- Returns
- A new KeyPoint adjusted to the original image size.
◆ RestoreOriginalSizeMatOfKeyPoint()
virtual MatOfKeyPoint OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeMatOfKeyPoint |
( |
MatOfKeyPoint | downscaledKeyPoints | ) |
|
|
virtual |
Restores the original size of the MatOfKeyPoint based on the downscale ratio.
- Parameters
-
downscaledKeyPoints | The MatOfKeyPoint containing the detected keypoints in the downscaled image. |
- Returns
- A new MatOfKeyPoint with the keypoints adjusted to the original image size.
◆ RestoreOriginalSizeMatOfPoint()
virtual MatOfPoint OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeMatOfPoint |
( |
MatOfPoint | downscaledPoints | ) |
|
|
virtual |
Restores the original size of the MatOfPoint based on the downscale ratio.
- Parameters
-
downscaledPoints | The MatOfPoint containing the detected points in the downscaled image. |
- Returns
- A new MatOfPoint with the points adjusted to the original image size.
◆ RestoreOriginalSizeMatOfPoint2f()
virtual MatOfPoint2f OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeMatOfPoint2f |
( |
MatOfPoint2f | downscaledPoints | ) |
|
|
virtual |
Restores the original size of the MatOfPoint2f based on the downscale ratio.
- Parameters
-
downscaledPoints | The MatOfPoint2f containing the detected points in the downscaled image. |
- Returns
- A new MatOfPoint2f with the points adjusted to the original image size.
◆ RestoreOriginalSizeMatOfPoint3()
virtual MatOfPoint3 OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeMatOfPoint3 |
( |
MatOfPoint3 | downscaledPoints | ) |
|
|
virtual |
Restores the original size of the MatOfPoint3 based on the downscale ratio.
- Parameters
-
downscaledPoints | The MatOfPoint3 containing the detected points in the downscaled image. |
- Returns
- A new MatOfPoint3 with the points adjusted to the original image size.
◆ RestoreOriginalSizeMatOfPoint3f()
virtual MatOfPoint3f OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeMatOfPoint3f |
( |
MatOfPoint3f | downscaledPoints | ) |
|
|
virtual |
Restores the original size of the MatOfPoint3f based on the downscale ratio.
- Parameters
-
downscaledPoints | The MatOfPoint3f containing the detected points in the downscaled image. |
- Returns
- A new MatOfPoint3f with the points adjusted to the original image size.
◆ RestoreOriginalSizeMatOfRect()
virtual MatOfRect OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeMatOfRect |
( |
MatOfRect | downscaledRects | ) |
|
|
virtual |
Restores the original size of the MatOfRect based on the downscale ratio.
- Parameters
-
downscaledRects | The MatOfRect containing the detected rectangles in the downscaled image. |
- Returns
- A new MatOfRect with the rectangles adjusted to the original image size.
◆ RestoreOriginalSizeMatOfRect2d()
virtual MatOfRect2d OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeMatOfRect2d |
( |
MatOfRect2d | downscaledRects | ) |
|
|
virtual |
Restores the original size of the MatOfRect2d based on the downscale ratio.
- Parameters
-
downscaledRects | The MatOfRect2d containing the detected rectangles in the downscaled image. |
- Returns
- A new MatOfRect2d with the rectangles adjusted to the original image size.
◆ RestoreOriginalSizeMatOfRotatedRect()
Restores the original size of the MatOfRotatedRect based on the downscale ratio.
- Parameters
-
downscaledRects | The MatOfRotatedRect containing the detected rectangles in the downscaled image. |
- Returns
- A new MatOfRotatedRect with the rectangles adjusted to the original image size.
◆ RestoreOriginalSizePoint()
virtual Point OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizePoint |
( |
Point | downscaledPoint | ) |
|
|
virtual |
Restores the original size of the Point based on the downscale ratio.
- Parameters
-
downscaledPoint | The detected point in the downscaled image. |
- Returns
- A new Point adjusted to the original image size.
◆ RestoreOriginalSizePoint3()
virtual Point3 OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizePoint3 |
( |
Point3 | downscaledPoint | ) |
|
|
virtual |
Restores the original size of the Point3 based on the downscale ratio.
- Parameters
-
downscaledPoint | The detected point in the downscaled image. |
- Returns
- A new Point3 adjusted to the original image size.
◆ RestoreOriginalSizeRect()
virtual Rect OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeRect |
( |
Rect | downscaledRect | ) |
|
|
virtual |
Restores the original size of the Rect based on the downscale ratio.
- Parameters
-
downscaledRect | The detected rectangle in the downscaled image. |
- Returns
- A new Rect adjusted to the original image size.
◆ RestoreOriginalSizeRect2d()
virtual Rect2d OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeRect2d |
( |
Rect2d | downscaledRect | ) |
|
|
virtual |
Restores the original size of the Rect2d based on the downscale ratio.
- Parameters
-
downscaledRect | The detected rectangle in the downscaled image. |
- Returns
- A new Rect2d adjusted to the original image size.
◆ RestoreOriginalSizeRotatedRect()
virtual RotatedRect OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.RestoreOriginalSizeRotatedRect |
( |
RotatedRect | downscaledRect | ) |
|
|
virtual |
Restores the original size of the RotatedRect based on the downscale ratio.
- Parameters
-
downscaledRect | The detected rectangle in the downscaled image. |
- Returns
- A new RotatedRect adjusted to the original image size.
◆ _downScaleFrameMat
Mat OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper._downScaleFrameMat |
|
protected |
◆ _downscaleRatio
float OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper._downscaleRatio = 2f |
|
protected |
◆ _frameCount
int OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper._frameCount = 0 |
|
protected |
◆ _frameSkippingRatio
int OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper._frameSkippingRatio = 2 |
|
protected |
◆ downscaleRatio
virtual float OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.downscaleRatio |
|
getset |
◆ frameSkippingRatio
virtual int OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.frameSkippingRatio |
|
getset |
The frame skipping ratio.
The documentation for this class was generated from the following file: