Vision_Library_(VLIB) ApplicationProgrammingInterfaceUserGui

更新时间:2023-04-14 20:08:02 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

D R A

F T O N L Y Vision Library (VLIB)Application Programming Interface Reference Guide Literature Number:SPRUG00C November 2009

D R A F T O N L Y 2

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D

R

A

F T

O

N

L Y

1About VLIB V2.1Release (102)

Exponentially-Weighted Running Mean of a Video (16-Bit) (11)

2.1

Introduction and Use Cases

..........................................................................................

112.2Specification ............................................................................................................112.3Comments ..............................................................................................................122.4Performance Benchmarks ............................................................................................122.5References .. (12)

3

Exponentially-Weighted Running Mean of a Video (32-Bit) (13)

3.1Introduction and Use Cases ..........................................................................................133.2Specification ............................................................................................................133.3Comments ..............................................................................................................143.4Performance Benchmarks ............................................................................................143.5References .. (14)

4

Exponentially-Weighted Running Variance of a Video (16-Bit) (15)

4.1Introduction and Use Cases ..........................................................................................154.2Specification ............................................................................................................154.3Performance Benchmarks .. (16)

5

Exponentially-Weighted Running Variance of a Video (32-Bit) (17)

5.1Introduction and Use Cases ..........................................................................................175.2Specification ............................................................................................................175.3Performance Benchmarks .. (18)

6

Uniformly-Weighted Running Mean of a Video (16-Bit) (19)

6.1Introduction and Use Cases ..........................................................................................196.2Specification ............................................................................................................196.3Performance Benchmarks ............................................................................................206.4References .. (20)

7

Uniformly-Weighted Running Variance of a Video (16-Bit) (21)

7.1Introduction and Use Cases ..........................................................................................217.2Specification ............................................................................................................217.3Performance Benchmarks .. (22)

8

Statistical Background Subtraction (16-Bit) (23)

8.1Introduction and Use Cases ..........................................................................................238.2Specification ............................................................................................................238.3Performance Benchmarks .. (24)

9

Statistical Background Subtraction (32-Bit) (25)

9.1Introduction and Use Cases ..........................................................................................259.2Specification ............................................................................................................259.3Performance Benchmarks .. (26)

10

Mixture of Gaussians Background Modeling for Grayscale Video (16-Bit) (27)

10.1Introduction and Use Cases ..........................................................................................2710.2Specification ............................................................................................................2710.3Performance Benchmarks ............................................................................................

28

3

SPRUG00C–November 2009Table of Contents

Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

D

R

A

F T

O

N

L Y

48a19d172e3f5727a5e962f6

10.4

References

..............................................................................................................

28

11

Mixture of Gaussians Background Modeling for Grayscale Video (32-Bit) (29)

11.1Introduction and Use Cases ..........................................................................................2911.2Specification (29)

11.3Performance Benchmarks ............................................................................................3011.4References .. (30)

12

8-Bit Image Extraction From 16-Bit Background Models (31)

12.1Introduction and Use Cases ..........................................................................................3112.2Specification (31)

12.3Requirements ...........................................................................................................3112.4Performance Benchmarks .. (31)

13

32-Bit Packing and Unpacking of Binary Mask Images (32)

13.1Introduction and Use Cases ..........................................................................................3213.2Specification ............................................................................................................3213.3Requirements ...........................................................................................................3213.4Performance Benchmarks .. (32)

14

Dilation (33)

14.1Introduction and Use Cases ..........................................................................................3314.2Specification ............................................................................................................3314.3Performance Benchmarks ............................................................................................3414.4Notes ....................................................................................................................3414.5References .. (35)

15

Erosion (36)

15.1Introduction and Use Cases ..........................................................................................3615.2Specification ............................................................................................................3615.3Performance Benchmarks ............................................................................................3715.4Notes ....................................................................................................................3715.5References .. (37)

16

Connected Components Labeling (38)

16.1Introduction and Use Cases ..........................................................................................3816.2Specification ............................................................................................................3816.3Performance Benchmarks ............................................................................................4016.4References .. (40)

17

Canny Edge Detection (41)

17.1Introduction and Use Cases ..........................................................................................4117.2Method ..................................................................................................................4117.3Performance Benchmarks ............................................................................................4117.4References .. (41)

18

Image Smoothing (for Canny Edge Detection) (42)

18.1Introduction and Use Cases ..........................................................................................4218.2Specification ............................................................................................................4218.3References .. (42)

19

2D Gradient Filtering (for Canny Edge Detection) (43)

19.1Introduction and Use Cases ..........................................................................................4319.2Specification ............................................................................................................4319.3Assumptions ............................................................................................................4419.4Performance Benchmarks ............................................................................................

44

4Contents

SPRUG00C–November 2009Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

D

R

A

F T

O

N

L Y

48a19d172e3f5727a5e962f6

19.5

References

..............................................................................................................

44

20

Non-Maximum Suppression (for Canny Edge Detection) (45)

20.1Introduction and Use Cases ..........................................................................................4520.2Specification ............................................................................................................4520.3Assumptions (46)

20.4Performance Benchmarks ............................................................................................4620.5References .. (46)

21

Hysteresis Thresholding (for Canny Edge Detection) (47)

21.1Introduction and Use Cases ..........................................................................................4721.2Specification ............................................................................................................4721.3Assumptions ............................................................................................................4821.4Performance Benchmarks ............................................................................................4821.5References .. (48)

22

Image Pyramid (8-Bit) (49)

22.1Introduction and Use Cases ..........................................................................................4922.2Specification ............................................................................................................4922.3Performance Benchmarks ............................................................................................4922.4References .. (49)

23

Image Pyramid (16-Bit) (50)

23.1Introduction and Use Cases ..........................................................................................5023.2Specification ............................................................................................................5023.3Performance Benchmarks ............................................................................................5023.4References .. (50)

24

Gaussian 5x5Pyramid Kernel (8-Bit) (51)

24.1Introduction and Use Cases ..........................................................................................5124.2Specification ............................................................................................................5124.3Performance Benchmarks ............................................................................................5224.4References .. (52)

25

Gaussian 5x5Pyramid Kernel (16-Bit) (53)

25.1Introduction and Use Cases ..........................................................................................5325.2Specification ............................................................................................................5325.3Performance Benchmarks ............................................................................................5325.4References .. (54)

26

Gradient 5x5Pyramid Kernel (8-Bit) (55)

26.1Introduction and Use Cases ..........................................................................................5526.2Specification ............................................................................................................5526.3Performance Benchmarks ............................................................................................5626.4References .. (56)

27

Recursive IIR Filter:Horizontal,First-Order (57)

27.1Introduction and Use Cases ..........................................................................................5727.2Specification ............................................................................................................5727.3Performance Benchmarks ............................................................................................5827.4Notes ....................................................................................................................5827.5References .. (58)

28

Recursive IIR Filter:Horizontal,First-Order (16Bit) (59)

28.1Introduction and Use Cases ..........................................................................................5928.2Specification ............................................................................................................

59

5

SPRUG00C–November 2009Contents

Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

D

R

A

F T

O

N

L Y

48a19d172e3f5727a5e962f6

28.3

Performance Benchmarks

............................................................................................

6028.4Notes ....................................................................................................................6028.5References .. (60)

29

Recursive IIR Filter:Vertical,First-Order (61)

29.1Introduction and Use Cases ..........................................................................................6129.2Specification (61)

29.3Performance Benchmarks ............................................................................................6229.4Notes ....................................................................................................................6229.5References .. (62)

30

Recursive IIR Filter:Vertical,First-Order (16-Bit) (63)

30.1Introduction and Use Cases ..........................................................................................6330.2Specification ............................................................................................................6330.3Performance Benchmarks ............................................................................................6430.4Notes ....................................................................................................................6430.5References .. (64)

31

Integral Image (8-Bit) (65)

31.1Introduction and Use Cases ..........................................................................................6531.2Specification ............................................................................................................6531.3Performance Benchmarks ............................................................................................6631.4References .. (66)

32

Integral Image (16-Bit) (67)

32.1Introduction and Use Cases ..........................................................................................6732.2Specification ............................................................................................................6732.3Performance Benchmarks ............................................................................................6832.4References .. (68)

33

Hough Transform for Lines (69)

33.1Introduction and Use Cases ..........................................................................................6933.2Specification ............................................................................................................6933.3Performance Benchmarks ............................................................................................7033.4Notes .. (70)

34

Harris Corner Score (71)

34.1Introduction and Use Cases ..........................................................................................7134.2Specification ............................................................................................................7134.3Performance Benchmarks ............................................................................................7234.4Notes ....................................................................................................................7234.5References .. (72)

35

Non-Maximal Suppression (73)

35.1Introduction and Use Cases ..........................................................................................7335.2Specification ............................................................................................................7335.3Performance Benchmarks .. (74)

36

Lucas-Kanade Feature Tracking (Sparse Optical Flow) (75)

36.1Introduction and Use Cases ..........................................................................................7536.2Specification ............................................................................................................7536.3Performance Benchmarks ............................................................................................7636.4Notes ....................................................................................................................7636.5References .. (76)

37

Normal Flow (16-Bit) (77)

37.1Introduction and Use Cases ..........................................................................................

77

6

Contents

SPRUG00C–November 2009Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

D

R

A

F T

O

N

L Y

48a19d172e3f5727a5e962f6

37.2

Specification

............................................................................................................

7737.3Performance Benchmarks (78)

38

Kalman Filter With 2-Dimension Observation and 4-Dimension State Vectors (16-Bit) (79)

38.1Introduction and Use Cases (79)

38.2Specification (79)

38.3Performance Benchmarks (80)

39

Kalman Filter With 4-Dimension Observation and 6-Dimension State Vectors (16-Bit) (81)

39.1Introduction and Use Cases ..........................................................................................8139.2Specification ............................................................................................................8139.3Performance Benchmarks .. (82)

40

Nelder-Mead Simplex (16-Bit) (83)

40.1Introduction and Use Cases ..........................................................................................8340.2Specification ............................................................................................................8340.3Performance Benchmarks .. (84)

41

Nelder-Mead Simplex for 3D Coordinate Space (16-Bit) (85)

41.1Introduction and Use Cases ..........................................................................................8541.2Specification ............................................................................................................8541.3Performance Benchmarks .. (86)

42

Legendre Moments Computation (16-Bit) (87)

42.1Introduction and Use Cases ..........................................................................................8742.2Specification ............................................................................................................8742.3Performance Benchmarks .. (88)

43

Initialization for Histogram Computation for Integer Scalars (8-Bit) (89)

43.1Introduction and Use Cases ..........................................................................................8943.2Specification ............................................................................................................8943.3Performance Benchmarks .. (89)

44

Histogram Computation for Integer Scalars (8-Bit) (90)

44.1Introduction and Use Cases ..........................................................................................9044.2Specification ............................................................................................................9044.3Performance Benchmarks .. (91)

45

Weighted Histogram Computation for Integer Scalars (8-Bit) (92)

45.1Introduction and Use Cases ..........................................................................................9245.2Specification ............................................................................................................9245.3Performance Benchmarks .. (93)

46

Initialization for Histogram Computation for Integer Scalars (16-Bit) (94)

46.1Introduction and Use Cases ..........................................................................................9446.2Specification ............................................................................................................9446.3Performance Benchmarkss . (94)

47

Histogram Computation for Integer Scalars (16-Bit) (95)

47.1Introduction and Use Cases ..........................................................................................9547.2Specification ............................................................................................................9547.3Performance Benchmarks .. (95)

48

Weighted Histogram Computation for Integer Scalars (16-Bit) (96)

48.1Introduction and Use Cases ..........................................................................................9648.2Specification ............................................................................................................9648.3Performance Benchmarks .. (97)

49

Histogram Computation for Multi-Dimensional Vectors (16-Bit)...............................................

98

7

SPRUG00C–November 2009Contents

Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

D R A F T O N L Y 48a19d172e3f5727a5e962f6

49.1Introduction and Use Cases

..........................................................................................9849.2Specification ............................................................................................................9849.3Performance Benchmarks .. (9950)

Weighted Histogram Computation for Multi-Dimensional Vectors (16-Bit)...............................10050.1Introduction and Use Cases ........................................................................................10050.2Specification ...........................................................................................................10050.3Performance Benchmarks . (10151)

Bhattacharya Distance (32-Bit)..........................................................................................10251.1Introduction and Use Cases ........................................................................................10251.2Specification ...........................................................................................................10251.3Performance Benchmarks . (10252)

L1Distance (City Block Distance)(16-bit)...........................................................................10352.1Introduction and Use Cases ........................................................................................10352.2Specification ...........................................................................................................10352.3Performance Benchmarks . (10353)

Luminance Extraction From YUV422..................................................................................10453.1Introduction and Use Cases ........................................................................................10453.2Specification ...........................................................................................................10453.3Performance Benchmarks . (10454)

Conversion From 8-Bit YUV422Interleaved to YUV422Planar ...............................................10554.1Introduction and Use Cases ........................................................................................10554.2Specification ...........................................................................................................10554.3Performance Benchmarks ...........................................................................................10554.4References (10555)

Conversion From 8-bit YUV422Interleaved to YUV420Planar ...............................................10655.1Introduction and Use Cases ........................................................................................10655.2Specification ...........................................................................................................10655.3Performance Benchmarks ...........................................................................................10655.4References (10656)

Conversion From 8-bit YUV422Interleaved to HSL Planar ....................................................10756.1Introduction and Use Cases ........................................................................................10756.2Specification ...........................................................................................................10756.3Performance Benchmarks ...........................................................................................10856.4References (10857)

Conversion From 8-bit YUV422Interleaved to LAB Planar ....................................................10957.1Introduction and Use Cases ........................................................................................10957.2Specification ...........................................................................................................10957.3Performance Benchmarks ...........................................................................................11057.4References (11058)

Conversion From 8-bit YUV422Interleaved to RGB Planar ....................................................11158.1Introduction and Use Cases ........................................................................................11158.2Specification ...........................................................................................................11158.3Performance Benchmarks ...........................................................................................11258.4References ............................................................................................................11259LUT-Based Conversion From 8-Bit YUV422Interleaved to LAB Planar .. (113)

59.1Introduction and Use Cases (113)

59.2Specification ...........................................................................................................1138Contents

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R A

F T O

N L Y 48a19d172e3f5727a5e962f6

59.3Performance Benchmarks ...........................................................................................11559.4References (11560)

Conversion From 8-Bit YUV422Semiplanar to YUV422Planar ..............................................11660.1Introduction and Use Cases ........................................................................................11660.2Specification ...........................................................................................................11660.3Performance Benchmarks ...........................................................................................11660.4References (11661)

Conversion From 8-Bit YUV422Planar to YUV422Interleaved ...............................................11761.1Introduction and Use Cases ........................................................................................11761.2Specification ...........................................................................................................11761.3Performance Benchmarks ...........................................................................................11761.4References (11762)

SAD Based Disparity Computation (8-Bit)...........................................................................11862.1Introduction and Use Cases ........................................................................................11862.2Specification ...........................................................................................................11862.3Performance Benchmarks ...........................................................................................11962.4References (11963)

SAD Based Disparity Computation (16-Bit).........................................................................

12063.1Introduction and Use Cases ........................................................................................12063.2Specification ...........................................................................................................12063.3Performance Benchmarks ...........................................................................................12163.4References ............................................................................................................1219SPRUG00C–November 2009Contents Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

D R A F T O N L Y Reference Guide SPRUG00C–November 2009Vision Library (VLIB)Application Programming Interface 1About VLIB V2.1Release

The Vision Library (VLIB)is a collection of computer vision algorithms that have been optimized for Texas Instruments’digital media processors.The VLIB Version 2.1software library was developed for devices with a C64x or C64x+processing core.This Application Programming interface (API)supports rapid integration of VLIB for embedded vision applications.These incarnations of release version 2.1are supplied:?vlib.l64p ?vlib_errchk.l64p ?vlib.l64?vlib_errchk.l64?vlib.lib ?VLIB_lib.mdl The first two libraries are for C64x+and the next two libraries are for C64x.vlib.l64p and vlib.l64are compiled with full file-level optimization enabled and with no debug information.vlib_errchk.l64p and vlib_errchk.l64versions contain more error checking of input arguments for some of the library functions.These builds are designed to produce richer error reporting for debug purposes but the added overhead can slow performance (marginally in most cases).Self-verifying examples are provided with the library to demonstrate how to use the API.The main test

application works with the latest version of TI’s Code Composer Studio,version 3.3.The vlib.lib library is a bit-exact version of the library for testing in PC (Windows)environments.It was compiled using Microsoft Visual C++6.0.The VLIB_lib.mdl file contains Simulink blocks for development and code generation in the matlab environment.

10Vision Library (VLIB)Application Programming Interface

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R A F T O N L Y 48a19d172e3f5727a5e962f6 Exponentially-Weighted Running Mean of a Video (16-Bit)2

Exponentially-Weighted Running Mean of a Video (16-Bit)2.1Introduction and Use Cases

A background subtraction algorithm might consist of:48a19d172e3f5727a5e962f6puting a representative statistic of the luma component for each pixel in a 48a19d172e3f5727a5e962f6beling deviations from this statistic as foreground .One such statistic is the exponentially-weighted (EW)running mean .2.2

Specification 2.2.1Function

Updates the exponential running mean of the luma component of a video.If the foreground mask bit is set,indicating there is obstruction by a foreground object,the running mean will not be updated.

2.2.2Inputs

EW running mean buffer to be updated (SQ8.7)short

*runningMean Most recent luma buffer (UQ8.0)char

*newLuma Foreground mask buffer (32-bit packed)unsigned int *mask32packed

Weight of the newest luma

(SQ0.15)short weight Number of pixels to process (UQ32.0)unsigned int pixelCount

2.2.3Output Returns VLIB Error Status int

2.2.4

Method In the implementation shown in Equation 1,the exponential running mean is updated for those pixels

where the foreground mask is zero:

updatedMean =(1–weight)×previousMean +weight ×newestData (1)

2.2.5

APIs

int VLIB_updateEWRMeanS16(

short *restrict runningMean,

const char *restrict newLuma,

const unsigned int *restrict mask32packed,

const short weight,

const unsigned int pixelCount);

The following function can be used to initialize a running mean buffer with luma values.In this process,all UQ8.0luma values are converted into SQ8.7representation.

int VLIB_initMeanWithLumaS16(

short *restrict runningMean,

const char *restrict lumaFrame,

const unsigned int pixelCount);

2.2.6Requirements

?I/O buffers are assumed to be double-word aligned in memory.

?pixelCount must be a multiple of 8.11SPRUG00C–November 2009

Vision Library (VLIB)Application Programming Interface

Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R

A F T O N L Y Exponentially-Weighted Running Mean of a Video (16-Bit)48a19d172e3f5727a5e962f6

2.3

Comments 2.3.1Adaptation Through Running Statistics

Over the course of a day,the illumination of an outdoor scene changes drastically.A background model needs to adapt to such effects and only report changes inherent to the scene,as opposed to its appearance.One practical approach is to compute the running (moving)statistics of the scene over a period of observation.2.3.2Foreground Objects

Based on inference or a priori knowledge,one could classify certain pixels of a video frame as foreground object (or outlier)and exclude them from the averaging operation.This mechanism would keep foreground object pixels from influencing the running mean of the background.2.4Performance Benchmarks

On-chip memory performance of the kernels has been measured as.VLIB_updateEWRMeanS16

1.0cycles/pixel VLIB_initMeanWithLumaS160.4cycles/pixel

2.5References

1.Chapter 15:Moving Average Filters in Digital Signal Processing:A Practical Guide for Engineers and Scientists ,Steven W.Smith,2002,ISBN 0-7506-7444.

2."Moving object recognition using and adaptive background memory"in Time-Varying Image Processing and Moving Object Recognition ,K.P.Karmann and A.von Brandt,Elsevier Science Publishers B.V.,1990.12Vision Library (VLIB)Application Programming Interface

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R A F T O N L Y 48a19d172e3f5727a5e962f6 Exponentially-Weighted Running Mean of a Video (32-Bit)3

Exponentially-Weighted Running Mean of a Video (32-Bit)3.1Introduction and Use Cases

A background subtraction algorithm commonly consists of:48a19d172e3f5727a5e962f6puting a representative statistic of the luma component for each pixel in a 48a19d172e3f5727a5e962f6beling deviations from this statistic as foreground .One such statistic is the exponentially-weighted (EW)running mean .3.2

Specification 3.2.1Function

Updates the exponential running mean of the luma component of a video.If the foreground mask bit is set for a pixel,indicating there is obstruction by a foreground object,the running mean will not be updated for that pixel.

3.2.2Inputs

EW running mean buffer to be updated (SQ8.23)int

*runningMean Most recent luma buffer (UQ8.0)char

*newLuma Foreground mask buffer (32-bit packed)unsigned int *mask32packed

Weight of the newest luma (SQ0.31)int weight Number of pixels to process (UQ32.0)unsigned int pixelCount

3.2.3Output Returns VLIB Error Status int

3.2.4

Method In the implementation shown in Equation 2,the exponential running mean is updated for those pixels

where the foreground mask is zero:

updatedMean =(1-weight)×previousMean +weight ×newestData (2)

3.2.5

APIs

int VLIB_updateEWRMeanS32(

int *restrict runningMean,

const char *restrict newLuma,

const unsigned int *restrict mask32packed,

const int weight,

const unsigned int pixelCount);

The following function can be used to initialize a running mean buffer with luma values.In this process,all UQ8.0luma values are converted into SQ8.23representation.

int VLIB_initMeanWithLumaS32(

int *restrict runningMean,

const char *restrict lumaFrame,

const unsigned int pixelCount);

3.2.6Requirements

?I/O buffers are assumed to be double-word aligned in memory.

?pixelCount must be a multiple of 4.13SPRUG00C–November 2009

Vision Library (VLIB)Application Programming Interface

Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R

A F T O N L Y Exponentially-Weighted Running Mean of a Video (32-Bit)48a19d172e3f5727a5e962f6

3.3

Comments 3.3.1Adaptation Through Running Statistics

Over the course of a day,the illumination of an outdoor scene changes drastically.A background model needs to adapt to such effects and only report changes inherent to the scene,as opposed to its appearance.One practical approach is to compute the running (moving)statistics of the scene over a period of observation.3.3.2Foreground Objects

Based on inference or a priori knowledge,one could classify certain pixels of a video frame as foreground object (or outlier)and exclude them from the averaging operation.This mechanism would keep foreground object pixels from influencing the running mean of the background.3.4Performance Benchmarks

On-chip memory performance of the kernels has been measured as.VLIB_updateEWRMeanS32

2.0cycles/pixel VLIB_initMeanWithLumaS320.8cycles/pixel

3.5References

1.Chapter 15:Moving Average Filters in Digital Signal Processing:A Practical Guide for Engineers and Scientists ,Steven W.Smith,2002,ISBN 0-7506-7444.

2."Moving object recognition using and adaptive background memory"in Time-Varying Image Processing and Moving Object Recognition ,K.P.Karmann and A.von Brandt,Elsevier Science Publishers B.V.,1990.14Vision Library (VLIB)Application Programming Interface

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R A F T O N L Y 48a19d172e3f5727a5e962f6 Exponentially-Weighted Running Variance of a Video (16-Bit)4

Exponentially-Weighted Running Variance of a Video (16-Bit)4.1Introduction and Use Cases

A background subtraction algorithm might consist of:48a19d172e3f5727a5e962f6puting a representative statistic of the luma component for each pixel in a 48a19d172e3f5727a5e962f6beling deviations from this statistic as foreground .The exponentially-weighted (EW)running variance of a pixel can be used in deciding whether an observed deviation is statistically significant.4.2

Specification 4.2.1Function

Updates the exponential running variance of the luma component of a video.If the foreground mask bit is set,indicating there is obstruction by a foreground object,the running variance will not be updated.

4.2.2Inputs

EW running variance to be updated (SQ12.3)short

*runningVar EW running mean buffer (SQ8.7)short

*runningMean

Most recent luma buffer (UQ8.0)char

*newLuma Foreground mask buffer (32-bit packed)unsigned int *mask32packed

Weight of the newest luma (SQ0.15)short weight Number of pixels to process (UQ32.0)unsigned int

pixelCount

4.2.3Output Returns VLIB Error Status int 4.2.4

Method

In the implementation shown in Equation 3,the exponential running variance is updated for those pixels where the foreground mask is zero:

updatedVar =(1–weight)×previousVar +weight ×(newestData –previousMean)2(3)

15SPRUG00C–November 2009

Vision Library (VLIB)Application Programming Interface

Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R

A F T O N L Y Exponentially-Weighted Running Variance of a Video (16-Bit)48a19d172e3f5727a5e962f6

4.2.5APIs

int VLIB_updateEWRVarianceS16(

short *restrict runningVar,

const short *restrict runningMean,

const char *restrict newLuma,

const unsigned int *restrict mask32packed,

const short weight,

const unsigned int pixelCount);

The following function can be used to initialize a running variance buffer with a constant variance value.The latter is expected to be in SQ12.3format already.int VLIB_initVarWithConstS16(

short *restrict runningVar,

const short constVar,

const unsigned int pixelCount);

4.2.6Requirements

?I/O buffers are assumed to be double-word aligned in memory.?pixelCount must be a multiple of 8.

4.3Performance Benchmarks

On-chip memory performance of the kernels has been measured as.VLIB_updateEWRVarianceS16

1.3cycles/pixel VLIB_initVarWithConstS160.1cycles/pixel

16Vision Library (VLIB)Application Programming Interface

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R A F T O N L Y 48a19d172e3f5727a5e962f6 Exponentially-Weighted Running Variance of a Video (32-Bit)5

Exponentially-Weighted Running Variance of a Video (32-Bit)5.1Introduction and Use Cases

A background subtraction algorithm might consist of:48a19d172e3f5727a5e962f6puting a representative statistic of the luma component for each pixel in a 48a19d172e3f5727a5e962f6beling deviations from this statistic as foreground .The exponentially-weighted (EW)running variance of a pixel can be used in deciding whether an observed deviation is statistically significant.5.2

Specification 5.2.1Function

Updates the exponential running variance of the luma component of a video.If the foreground mask bit is set,indicating there is obstruction by a foreground object,the running variance will not be updated.

5.2.2Inputs

EW running variance to be updated (SQ16.15)int

*runningVar EW running mean buffer (SQ8.23)int

*runningMean

Most recent luma buffer (UQ8.0)char

*newLuma Foreground mask buffer (32-bit packed)unsigned int *mask32packed

Weight of the newest luma

(SQ0.31)int weight Number of pixels to process (UQ32.0)unsigned int pixelCount

5.2.3Output Returns VLIB Error Status int

5.2.4

Method In the implementation shown in Equation 4,the exponential running variance is updated for those pixels

where the foreground mask is zero:

updatedVar =(1–weight)×previousVar +weight ×(newestData –previousMean)2(4)

5.2.5

APIs int VLIB_updateEWRVarianceS32(

int *restrict runningVar,

const int *restrict runningMean,

const char *restrict newLuma,

const unsigned int *restrict mask32packed,

const int weight,

const unsigned int pixelCount);

The following function can be used to initialize a running variance buffer with a constant variance value.The latter is expected to be in SQ16.15format already.

int VLIB_initVarWithConstS32(

int *restrict runningVar,

const int constVar,

const unsigned int pixelCount);

5.2.6Requirements

?I/O buffers are assumed to be double-word aligned in memory.

?pixelCount must be a multiple of 4.

17SPRUG00C–November 2009Vision Library (VLIB)Application Programming Interface

Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D R

A F T O N L Y Exponentially-Weighted Running Variance of a Video (32-Bit)48a19d172e3f5727a5e962f6

5.3Performance Benchmarks

On-chip memory performance of the kernels has been measured as.VLIB_updateEWRVarianceS32

2.3cycles/pixel VLIB_initVarWithConstS320.3cycles/pixel

18Vision Library (VLIB)Application Programming Interface

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D

R

A F T

O

N

L Y

48a19d172e3f5727a5e962f6 Uniformly-Weighted Running Mean of a Video (16-Bit)

6Uniformly-Weighted Running Mean of a Video (16-Bit)6.1

Introduction and Use Cases

A background subtraction algorithm might consist of:

48a19d172e3f5727a5e962f6puting a representative statistic of the luma component for each pixel in a video.

48a19d172e3f5727a5e962f6beling deviations from this statistic as foreground .One such statistic is the uniformly-weighted (UW)running mean (a.k.a.,moving average).

Special requirements:

For averaging,a video buffer of N luma frames need to be stored in memory.The user is expected to maintain this buffer and pass the appropriate frame pointers to the function.

6.2

Specification

6.2.1

Function

Updates the (uniformly-weighted)running mean of the luma component of a video.If the foreground mask bit of either the newest or the oldest video frame is set,indicating there is obstruction by a foreground object,the running mean will not be updated.

6.2.2Inputs

Updated running mean buffer (SQ8.7)short *updatedMean Previous running mean buffer (SQ8.7)short *previousMean Most recent luma buffer (UQ8.0)char

*newestData Oldest luma buffer (UQ8.0)unsigned int *oldestData Newest mask buffer (32-bit packed)unsigned int *newestMask32packed Oldest mask buffer

(32-bit packed)unsigned int *oldestMask32packed Number of pixels to in the luma buffer (UQ32.0)unsigned int pixelCount Number of frames in video buffer

(UQ8.0)

char

frameCount

6.2.3

Output

Returns VLIB Error Status

int

6.2.4Method

In the implementation shown in Equation 5,the running mean is updated for those pixels where the foreground mask of the oldest and newest frames are zero:

updatedMean =previousMean +(newestData –oldestData)÷(frameCount –1)

(5)

19

SPRUG00C–November 2009Vision Library (VLIB)Application Programming Interface

Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

D R

A F T O N L Y Uniformly-Weighted Running Mean of a Video (16-Bit)48a19d172e3f5727a5e962f6

6.2.5APIs

int VLIB_updateUWRMeanS16(

short *restrict updatedMean,

const short *restrict previousMean,

const char *restrict newestData,

const char *restrict oldestData,

const unsigned int *restrict newestMask32packed,

const unsigned int *restrict oldestMask32packed,

const unsigned int pixelCount,

const char frameCount);

The following function can be used to initialize a running mean buffer with luma values.In this process,all UQ8.0luma values are converted into SQ8.7representation.

int VLIB_initMeanWithLumaS16(short *restrict runningMean,const char *restrict lumaFrame,const unsigned int pixelCount);6.2.6Requirements

?I/O buffers are assumed to be double-word aligned in memory.

?pixelCount must be a multiple of 8.

6.3Performance Benchmarks

On-chip memory performance has been measured as 1.0cycles/pixel.

6.4References

1.Chapter 15:Moving Average Filters,in Digital Signal Processing:A Practical Guide for Engineers and

Scientists ,Steven W.Smith,2002,ISBN 0-7506-7444.

20Vision Library (VLIB)Application Programming Interface

SPRUG00C–November 2009Submit Documentation Feedback Copyright ?2009,Texas Instruments Incorporated

D

R

A

F T

O

N

L Y

48a19d172e3f5727a5e962f6 Uniformly-Weighted Running Variance of a Video (16-Bit)

7Uniformly-Weighted Running Variance of a Video (16-Bit)7.1

Introduction and Use Cases

A background subtraction algorithm might consist of:

48a19d172e3f5727a5e962f6puting a representative statistic of the luma component for each pixel in a video.

48a19d172e3f5727a5e962f6beling deviations from this statistic as foreground .The uniformly-weighted running variance of a pixel can be used in deciding whether an observed deviation is statistically significant.

7.2

Specification

7.2.1

Function

Updates the (uniformly-weighted)running variance of the luma component of a video.If the foreground mask bit of either the newest or the oldest video frame is set,indicating there is obstruction by a foreground object,the running variance will not be updated.7.2.2

Inputs

Updated running variance buffer

(SQ12.3)short *updatedVar

Updated running mean buffer (SQ8.7)short *updatedMean Previous running mean buffer (SQ8.8)short *previousMean Previous running variance buffer

(SQ12.3)short *previousVar Most recent luma buffer (SQ8.0)char

*newestData Newest foreground mask (32-bit packed)unsigned int *newestMask32packed Oldest foreground mask (32-bit packed)unsigned int *oldestMask32packed Number of pixels to process

(UQ32.0)unsigned int pixelCount Number of frames in video buffer

(UQ8.0)

char

frameCount

7.2.3

Output

Returns VLIB Error Status

int

7.2.4Method

In the implementation shown in Equation 6,the running variance is updated for those pixels where the foreground mask of the oldest and newest frames are zero:

updatedVar =1÷(frameCount–1)×(frameCount×previousVar +(newestData–updatedMean)×(newestData–previousMean))

(6)

21

SPRUG00C–November 2009Vision Library (VLIB)Application Programming Interface

Submit Documentation Feedback

Copyright ?2009,Texas Instruments Incorporated

本文来源:https://www.bwwdw.com/article/2ucq.html

Top