OpenCV for Unity 2.6.5
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper Class Reference

A helper component for optimizing image processing in Unity by managing frame skipping and downscaling operations. v1.1.1. More...

Public Member Functions

virtual void Dispose ()
 To release the resources for the initialized method.
 
virtual Mat GetDownScaleMat (Mat originalMat)
 Gets the mat that downscaled the original mat. if downscaleRatio == 1 , return originalMat.
 
virtual bool IsCurrentFrameSkipped ()
 Indicates whether the current frame is skipped.
 

Protected Member Functions

void OnValidate ()
 

Protected Attributes

float _downscaleRatio = 2f
 
int _frameSkippingRatio = 2
 
Mat downScaleFrameMat
 The downscale frame mat.
 
int frameCount = 0
 The frame count.
 

Properties

virtual float downscaleRatio [get, set]
 The downscale ratio.
 
virtual int frameSkippingRatio [get, set]
 The frame skipping ratio.
 

Detailed Description

A helper component for optimizing image processing in Unity by managing frame skipping and downscaling operations. v1.1.1.

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:

// Example usage of the ImageOptimizationHelper component
ImageOptimizationHelper imageHelper = gameObject.AddComponent<ImageOptimizationHelper>();
imageHelper.downscaleRatio = 2.0f;
imageHelper.frameSkippingRatio = 3;
// Check if the current frame should be skipped
if (!imageHelper.IsCurrentFrameSkipped())
{
// Perform operations on the downscaled image
Mat optimizedMat = imageHelper.GetDownScaleMat(originalMat);
}
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:40
virtual Mat GetDownScaleMat(Mat originalMat)
Gets the mat that downscaled the original mat. if downscaleRatio == 1 , return originalMat.
Definition ImageOptimizationHelper.cs:100
virtual bool IsCurrentFrameSkipped()
Indicates whether the current frame is skipped.
Definition ImageOptimizationHelper.cs:87

Member Function Documentation

◆ Dispose()

virtual void OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.Dispose ( )
virtual

To release the resources for the initialized method.

◆ GetDownScaleMat()

virtual Mat OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.GetDownScaleMat ( Mat originalMat)
virtual

Gets the mat that downscaled the original mat. if downscaleRatio == 1 , return originalMat.

Returns
The downscale mat.
Parameters
originalMatOriginal mat.

◆ 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.

◆ OnValidate()

void OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.OnValidate ( )
protected

Member Data Documentation

◆ _downscaleRatio

float OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper._downscaleRatio = 2f
protected

◆ _frameSkippingRatio

int OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper._frameSkippingRatio = 2
protected

◆ downScaleFrameMat

Mat OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.downScaleFrameMat
protected

The downscale frame mat.

◆ frameCount

int OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.frameCount = 0
protected

The frame count.

Property Documentation

◆ downscaleRatio

virtual float OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.downscaleRatio
getset

The downscale ratio.

◆ frameSkippingRatio

virtual int OpenCVForUnity.UnityUtils.Helper.ImageOptimizationHelper.frameSkippingRatio
getset

The frame skipping ratio.


The documentation for this class was generated from the following file: