frame

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO: Implement different threshold for day/night. The brightness value can be used as the determinant.
	BinaryThresholdParam float64 = 0.784313725
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	OrdinalNumber             int     `json:"ordinal-number"`
	ColorDifference           float64 `json:"color-difference"`
	BinaryThresholdDifference float64 `json:"binary-threshold-difference"`
	Brightness                float64 `json:"brightness"`
}

Strucutre representing a single video frame and its calculated parameters. TODO: When it coms to BinaryThreshold we need to test which approach gives better results. Currently we are comparing the BT of the previous and current frame and than calcualte the white_pixels / all_pixels Alternatively we can just count the occurance of white pixels and return the non-normalized result

func CreateNewFrame

func CreateNewFrame(currentFrame, previousFrame image.Image, ordinalNumber int) *Frame

Create a new frame instance by providing the current and previous frame images and the ordinal number of the frame.

func (*Frame) ToBuffer

func (frame *Frame) ToBuffer() []string

Convert the frame string buffer format accepted by the CSV encoder.

type FramesCollection

type FramesCollection struct {
	Frames map[int]*Frame
	// contains filtered or unexported fields
}

Structure representing the collection of video frames.

func CreateNewFramesCollection

func CreateNewFramesCollection(frames int) *FramesCollection

Create a new frames collection with a given capacity of frames.

func (*FramesCollection) Append

func (frames *FramesCollection) Append(frame *Frame) error

Add a new frame to the frames collection.

func (*FramesCollection) CalculateStatistics

func (frames *FramesCollection) CalculateStatistics(movingMeanResolution int) FramesStatistics

Calculate the descriptive statistics values for the given frames collection.

func (*FramesCollection) ExportCsvReport

func (frames *FramesCollection) ExportCsvReport(file io.Writer) error

Write the CSV format frames report to the provided writer which can be a file reference.

func (*FramesCollection) ExportJsonReport

func (frames *FramesCollection) ExportJsonReport(file io.Writer) error

Write the JSON format frames report to the provided writer which can be a file reference.

func (*FramesCollection) Get

func (frames *FramesCollection) Get(frameNumber int) (*Frame, error)

Get a frame from the frames collection by the frame ordinal number.

func (*FramesCollection) GetAll

func (frames *FramesCollection) GetAll() []*Frame

Get all frames sorted by the frame ordinal number. TODO: Add tests

type FramesStatistics

type FramesStatistics struct {
	BrightnessMean                             float64   `json:"brightness-mean"`
	BrightnessMovingMean                       []float64 `json:"brightness-moving-mean"`
	BrightnessStandardDeviation                float64   `json:"brightness-standard-deviation"`
	BrightnessMax                              float64   `json:"brightness-max"`
	ColorDifferenceMean                        float64   `json:"color-difference-mean"`
	ColorDifferenceMovingMean                  []float64 `json:"color-difference-moving-mean"`
	ColorDifferenceStandardDeviation           float64   `json:"color-difference-standard-deviation"`
	ColorDifferenceMax                         float64   `json:"color-difference-max"`
	BinaryThresholdDifferenceMean              float64   `json:"binary-threshold-difference-mean"`
	BinaryThresholdDifferenceMovingMean        []float64 `json:"binary-threshold-difference-moving-mean"`
	BinaryThresholdDifferenceStandardDeviation float64   `json:"binary-threshold-difference-standard-deviation"`
	BinaryThresholdDifferenceMax               float64   `json:"binary-threshold-difference-max"`
}

Structure containing frames descriptive statistics values.

func CreateNewFramesStatistics

func CreateNewFramesStatistics(frames []*Frame, movingMeanResolution int) *FramesStatistics

TODO: movingMeanResolution validation > 1

func (*FramesStatistics) ExportCsvReport

func (statistics *FramesStatistics) ExportCsvReport(file io.Writer) error

Write the CSV format statistics report to the provided writer which can be a file reference.

func (*FramesStatistics) ExportJsonReport

func (statistics *FramesStatistics) ExportJsonReport(file io.Writer) error

Write the JSON format statistics report to the provided writer which can be a file reference.

Jump to

Keyboard shortcuts

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