Utility and System Functions and Macros

Error Handling

Errors in argument type cause a TypeError exception. OpenCV errors cause an cv.error exception.

For example a function argument that is the wrong type produces a TypeError :

>>> import cv
>>> cv.LoadImage(4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument 1 must be string, not int

A function with the

>>> cv.CreateMat(-1, -1, cv.CV_8UC1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
error: Non-positive width or height

GetTickCount

Comments from the Wiki

GetTickCount() → long

Returns the number of ticks.

The function returns number of the ticks starting from some platform-dependent event (number of CPU ticks from the startup, number of milliseconds from 1970th year, etc.). The function is useful for accurate measurement of a function/user-code execution time. To convert the number of ticks to time units, use GetTickFrequency .

GetTickFrequency

Comments from the Wiki

GetTickFrequency() → long

Returns the number of ticks per microsecond.

The function returns the number of ticks per microsecond. Thus, the quotient of GetTickCount and GetTickFrequency will give the number of microseconds starting from the platform-dependent event.

Table Of Contents

Previous topic

Clustering

Next topic

imgproc. Image Processing

This Page