render

package
v0.0.0-...-2c0f3e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Black  = color.RGBA{R: 0, G: 0, B: 0, A: 255}
	White  = color.RGBA{R: 255, G: 255, B: 255, A: 255}
	Yellow = color.RGBA{R: 255, G: 255, B: 50, A: 255}
	Pink   = color.RGBA{R: 255, G: 0, B: 255, A: 255}
)

Functions

func DetectionBoxes

func DetectionBoxes(img *gocv.Mat, detectResults []postprocess.DetectResult,
	classNames []string, font Font, lineThickness int)

DetectionBoxes renders the bounding boxes around the object detected

func FaceKeyPoints

func FaceKeyPoints(img *gocv.Mat, keyPoints [][]postprocess.KeyPoint)

FaceKeyPoints renders the provided face landmark keypoints for all faces detected

func OrientedBoundingBoxes

func OrientedBoundingBoxes(img *gocv.Mat, detectResults []postprocess.DetectResult,
	classNames []string, font Font, lineThickness int)

OrientedBoundingBoxes renders the oriented bounding boxes around the object detected

func PaintSegmentToFile

func PaintSegmentToFile(filename string, height, width int,
	segMask []uint8, alpha float32) error

PaintSegmentToFile paints the segment mask to and image file

func PoseKeyPoints

func PoseKeyPoints(img *gocv.Mat, keyPoints [][]postprocess.KeyPoint,
	lineThickness int)

PoseKeyPoints renders the provided pose estimation keypoints for all objects

func SegmentMask

func SegmentMask(img *gocv.Mat, segMask []uint8, alpha float32)

SegmentMask renders the provided segment masks as a transparent overlay on top of the whole image

func SegmentOutline

func SegmentOutline(img *gocv.Mat, segMask []uint8,
	detectResults []postprocess.DetectResult, minArea float64,
	classNames []string, font Font, lineThickness int) error

SegmentOutline renders the provided segment masks object outline for all objects. The minArea is the value required for the masks minimum area for it to be used, this is needed to filter out small amounts of noise/artifacts contained in the mask from inferencing.

func TrackerBoxes

func TrackerBoxes(img *gocv.Mat, trackResults []*tracker.STrack,
	classNames []string, font Font, lineThickness int)

TrackerBoxes renders the bounding boxes around the object detected for tracker results

func TrackerMask

func TrackerMask(img *gocv.Mat, segMask []uint8,
	trackResults []*tracker.STrack, detectResults []postprocess.DetectResult,
	alpha float32)

TrackerMask renders the provided segment masks as a transparent overlay on top of the whole image. alpha is the amount of opacity to apply to the mask overlay.

func TrackerOrientedBoundingBoxes

func TrackerOrientedBoundingBoxes(img *gocv.Mat, trackResults []*tracker.STrack,
	detectResults []postprocess.DetectResult, classNames []string, font Font,
	lineThickness int)

func TrackerOutlines

func TrackerOutlines(img *gocv.Mat, segMask []uint8,
	trackResults []*tracker.STrack, detectResults []postprocess.DetectResult,
	minArea float64, classNames []string, font Font, lineThickness int,
	epsilon float64) error

TrackerOutlines draws the object segmentation outlines around tracker objects. The minArea is the value required for the masks minimum area for it to be used, this is needed to filter out small amounts of noise/artifacts contained in the mask from inferencing. The epsilon value effects the shape of the polygon outline. The higher the value the more round it becomes.

func Trail

func Trail(img *gocv.Mat, trackResults []*tracker.STrack,
	trail *tracker.Trail, style TrailStyle)

Trail draws the tracker trail lines on the source image.

Types

type Alignment

type Alignment int
const (
	Left   Alignment = 1
	Center Alignment = 2
	Right  Alignment = 3
)

type Font

type Font struct {
	Face      gocv.HersheyFont
	Scale     float64
	Color     color.RGBA
	Thickness int
	LineType  gocv.LineType
	// Padding to place around text
	LeftPad   int
	RightPad  int
	TopPad    int
	BottomPad int
	// Alignment of the text label to the bounding box
	Alignment Alignment
}

Font defines the parameters for rendering text on an image using GoCV

func DefaultFont

func DefaultFont() Font

DefaultFont returns default font settings

func DefaultFontAlign

func DefaultFontAlign(align Alignment) Font

DefaultFont returns default font settings with specified alignment

type TrailStyle

type TrailStyle struct {
	// LineSame defines if the color of the trail line should be the
	// same color as that of the bounding box.  If set to false then use
	// the color specified at LineColor
	LineSame      bool
	LineColor     color.RGBA
	LineThickness int
	// CircleSame defines if the color of the midpoint circle should be the
	// same color as that of the bounding box.  If set to false then use
	// the color specified at CircleColor
	CircleSame   bool
	CircleColor  color.RGBA
	CircleRadius int
}

TrailStyle defines the parameters used for rendering the trail style

func DefaultTrailStyle

func DefaultTrailStyle() TrailStyle

DefaultTrailStyle returns default trail style settings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL