File: per_element_operations.rst

package info (click to toggle)
opencv 2.3.1-11%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 82,284 kB
  • sloc: xml: 493,314; cpp: 334,117; ansic: 108,641; java: 15,407; python: 14,061; sh: 107; makefile: 61
file content (306 lines) | stat: -rw-r--r-- 9,187 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
Per-element Operations
=======================

.. highlight:: cpp



.. index:: gpu::add

gpu::add
------------
.. ocv:function:: void gpu::add(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)

.. ocv:function:: void gpu::add(const GpuMat& src1, const Scalar& src2, GpuMat& dst)

    Computes a matrix-matrix or matrix-scalar sum.

    :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.

    :param src2: Second source matrix or a scalar to be added to ``src1``.

    :param dst: Destination matrix with the same size and type as ``src1``.

.. seealso:: 
   :ocv:func:`add`

.. index:: gpu::subtract

gpu::subtract
-----------------
.. ocv:function:: void gpu::subtract(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)

.. ocv:function:: void gpu::subtract(const GpuMat& src1, const Scalar& src2, GpuMat& dst)

    Computes a matrix-matrix or matrix-scalar difference.

    :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.

    :param src2: Second source matrix or a scalar to be subtracted from ``src1``.

    :param dst: Destination matrix with the same size and type as ``src1``.

.. seealso:: 
   :ocv:func:`subtract`



.. index:: gpu::multiply

gpu::multiply
-----------------
.. ocv:function:: void gpu::multiply(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)

.. ocv:function:: void gpu::multiply(const GpuMat& src1, const Scalar& src2, GpuMat& dst)

    Computes a matrix-matrix or matrix-scalar per-element product.

    :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.

    :param src2: Second source matrix or a scalar to be multiplied by ``src1`` elements.

    :param dst: Destination matrix with the same size and type as ``src1``.

.. seealso:: 
   :ocv:func:`multiply`


.. index:: gpu::divide

gpu::divide
---------------
.. ocv:function:: void gpu::divide(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)

.. ocv:function:: void gpu::divide(const GpuMat& src1, const Scalar& src2, GpuMat& dst)

    Computes a matrix-matrix or matrix-scalar sum.

    :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.

    :param src2: Second source matrix or a scalar. The ``src1`` elements are divided by it.

    :param dst: Destination matrix with the same size and type as ``src1``.

This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mode.

.. seealso:: 
   :ocv:func:`divide`



.. index:: gpu::exp

gpu::exp
------------
.. ocv:function:: void gpu::exp(const GpuMat& src, GpuMat& dst)

    Computes an exponent of each matrix element.

    :param src: Source matrix. ``CV_32FC1`` matrixes are supported for now.

    :param dst: Destination matrix with the same size and type as ``src``.

.. seealso:: 
   :ocv:func:`exp`



.. index:: gpu::log

gpu::log
------------
.. ocv:function:: void gpu::log(const GpuMat& src, GpuMat& dst)

    Computes a natural logarithm of absolute value of each matrix element.

    :param src: Source matrix. ``CV_32FC1`` matrixes are supported for now.

    :param dst: Destination matrix with the same size and type as ``src``.

.. seealso:: :ocv:func:`log`



.. index:: gpu::absdiff

gpu::absdiff
----------------
.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)

.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const Scalar& src2, GpuMat& dst)

    Computes per-element absolute difference of two matrices (or of a matrix and scalar).

    :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now.

    :param src2: Second source matrix or a scalar to be added to ``src1``.

    :param dst: Destination matrix with the same size and type as ``src1``.

.. seealso:: 
   :ocv:func:`absdiff`

.. index:: gpu::compare

gpu::compare
----------------
.. ocv:function:: void gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int cmpop)

    Compares elements of two matrices.

    :param src1: First source matrix. ``CV_8UC4`` and ``CV_32FC1`` matrices are supported for now.

    :param src2: Second source matrix with the same size and type as ``a``.

    :param dst: Destination matrix with the same size as ``a`` and the ``CV_8UC1`` type.

    :param cmpop: Flag specifying the relation between the elements to be checked:
        
            * **CMP_EQ:** ``src1(.) == src2(.)``
            * **CMP_GT:** ``src1(.) < src2(.)``
            * **CMP_GE:** ``src1(.) <= src2(.)``
            * **CMP_LT:** ``src1(.) < src2(.)``
            * **CMP_LE:** ``src1(.) <= src2(.)``
            * **CMP_NE:** ``src1(.) != src2(.)``

.. seealso:: 
  :ocv:func:`compare`


.. index:: gpu::bitwise_not

gpu::bitwise_not
--------------------
.. ocv:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat())

.. ocv:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream)

    Performs a per-element bitwise inversion.

    :param src: Source matrix.

    :param dst: Destination matrix with the same size and type as ``src``.

    :param mask: Optional operation mask. 8-bit single channel image.

    :param stream: Stream for the asynchronous version.



.. index:: gpu::bitwise_or

gpu::bitwise_or
-------------------
.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())

.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)

    Performs a per-element bitwise disjunction of two matrices.

    :param src1: First source matrix.

    :param src2: Second source matrix with the same size and type as ``src1``.

    :param dst: Destination matrix with the same size and type as ``src1``.

    :param mask: Optional operation mask. 8-bit single channel image.

    :param stream: Stream for the asynchronous version.



.. index:: gpu::bitwise_and

gpu::bitwise_and
--------------------
.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())

.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)

    Performs a per-element bitwise conjunction of two matrices.

    :param src1: First source matrix.

    :param src2: Second source matrix with the same size and type as ``src1``.

    :param dst: Destination matrix with the same size and type as ``src1``.

    :param mask: Optional operation mask. 8-bit single channel image.

    :param stream: Stream for the asynchronous version.



.. index:: gpu::bitwise_xor

gpu::bitwise_xor
--------------------
.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())

.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)

    Performs a per-element bitwise ``exclusive or`` operation of two matrices.

    :param src1: First source matrix.

    :param src2: Second source matrix with the same size and type as ``src1``.

    :param dst: Destination matrix with the same size and type as ``src1``.

    :param mask: Optional operation mask. 8-bit single channel image.

    :param stream: Stream for the asynchronous version.



.. index:: gpu::min

gpu::min
------------
.. ocv:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)

.. ocv:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream)

.. ocv:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst)

.. ocv:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream)

    Computes the per-element minimum of two matrices (or a matrix and a scalar).

    :param src1: First source matrix.

    :param src2: Second source matrix or a scalar to compare ``src1`` elements with.

    :param dst: Destination matrix with the same size and type as ``src1``.

    :param stream: Stream for the asynchronous version.

.. seealso:: 
   :ocv:func:`min`



.. index:: gpu::max

gpu::max
------------
.. ocv:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)

.. ocv:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream)

.. ocv:function:: void gpu::max(const GpuMat& src1, double src2, GpuMat& dst)

.. ocv:function:: void gpu::max(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream)

    Computes the per-element maximum of two matrices (or a matrix and a scalar).

    :param src1: First source matrix.

    :param src2: Second source matrix or a scalar to compare ``src1`` elements with.

    :param dst: Destination matrix with the same size and type as ``src1``.

    :param stream: Stream for the asynchronous version.

.. seealso:: 
   :ocv:func:`max`