Chapter 5. Array Operations

More Things You Can Do with Arrays

As we saw in the previous chapter, there are many basic operations on arrays that are now handled by member functions of the array classes. In addition to those, however, there are many more operations that are most naturally represented as “friend” functions that either take array types as arguments, have array types as return values, or both. The functions, together with their arguments, will be covered in more detail after Table 5-1.

Table 5-1. Basic matrix and image operators
Function Description
cv::abs() Return absolute value of all elements in an array
cv::absdiff() Return absolute value of differences between two arrays
cv::add() Perform element-wise addition of two arrays
cv::addWeighted() Perform element-wise weighted addition of two arrays (alpha blending)
cv::bitwise_and() Compute element-wise bit-level AND of two arrays
cv::bitwise_not() Compute element-wise bit-level NOT of two arrays
cv::bitwise_or() Compute element-wise bit-level OR of two arrays
cv::bitwise_xor() Compute element-wise bit-level XOR of two arrays
cv::calcCovarMatrix() Compute covariance of a set of n-dimensional vectors
cv::cartToPolar() Compute angle and magnitude from a two-dimensional vector field
cv::checkRange() Check array for invalid values
cv::compare() Apply selected comparison operator to all elements in two arrays
cv::completeSymm() Symmetrize matrix by copying elements from one half to the ...

Get Learning OpenCV 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.