Skip to content

Commit

Permalink
added GetOverlayAlpha() and GetLineWidth()
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-nv committed Mar 5, 2023
1 parent a0f193c commit 634573a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions c/detectNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ detectNet::detectNet( float meanPixel ) : tensorNet()
mTracker = NULL;
mMeanPixel = meanPixel;
mLineWidth = 2.0f;

mNumClasses = 0;
mClassColors = NULL;

mDetectionSets = NULL;
mDetectionSet = 0;
mMaxDetections = 0;
mOverlayAlpha = DETECTNET_DEFAULT_ALPHA;

mConfidenceThreshold = DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD;
mClusteringThreshold = DETECTNET_DEFAULT_CLUSTERING_THRESHOLD;

}


Expand Down Expand Up @@ -1136,4 +1136,6 @@ void detectNet::SetOverlayAlpha( float alpha )

for( uint32_t n=0; n < numClasses; n++ )
mClassColors[n].w = alpha;

mOverlayAlpha = alpha;
}
11 changes: 11 additions & 0 deletions c/detectNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,21 @@ class detectNet : public tensorNet
*/
inline void SetClassColor( uint32_t classIndex, float r, float g, float b, float a=255.0f ) { mClassColors[classIndex] = make_float4(r,g,b,a); }

/**
* Retrieve the line width used during overlay when OVERLAY_LINES is used.
*/
inline float GetLineWidth() const { return mLineWidth; }

/**
* Set the line width used during overlay when OVERLAY_LINES is used.
*/
inline void SetLineWidth( float width ) { mLineWidth = width; }

/**
* Retrieve the overlay alpha blending value for classes that don't have it explicitly set (between 0-255).
*/
inline float GetOverlayAlpha() const { return mOverlayAlpha; }

/**
* Set overlay alpha blending value for all classes (between 0-255).
*/
Expand Down Expand Up @@ -533,6 +543,7 @@ class detectNet : public tensorNet

float mMeanPixel;
float mLineWidth;
float mOverlayAlpha;

float4* mClassColors;

Expand Down

0 comments on commit 634573a

Please sign in to comment.