File: operations_on_matrices.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 (229 lines) | stat: -rw-r--r-- 6,941 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
Operations on Matrices
======================

.. highlight:: cpp

.. index:: gpu::transpose

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

    Transposes a matrix.

    :param src: Source matrix. 1-, 4-, 8-byte element sizes are supported for now.

    :param dst: Destination matrix.

.. seealso::
   :ocv:func:`transpose` 

.. index:: gpu::flip

gpu::flip
-------------
.. ocv:function:: void gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode)

    Flips a 2D matrix around vertical, horizontal, or both axes.

    :param src: Source matrix. Only  ``CV_8UC1``  and  ``CV_8UC4``  matrices are supported for now.

    :param dst: Destination matrix.

    :param flipCode: Flip mode for the source:
        
            * ``0`` Flips around x-axis.
            
            * ``>0`` Flips around y-axis.
            
            * ``<0`` Flips around both axes.
            

.. seealso::
   :ocv:func:`flip` 

.. index:: gpu::LUT

gpu::LUT
------------
.. ocv:function:: void gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst)

    Transforms the source matrix into the destination matrix using the given look-up table: ``dst(I) = lut(src(I))``

    :param src: Source matrix.  ``CV_8UC1``  and  ``CV_8UC3``  matrices are supported for now.

    :param lut: Look-up table of 256 elements. It is a continuous ``CV_8U`` matrix.

    :param dst: Destination matrix with the same depth as  ``lut``  and the same number of channels as  ``src``.
            

.. seealso:: 
   :ocv:func:`LUT` 

.. index:: gpu::merge

gpu::merge
--------------
.. ocv:function:: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst)

.. ocv:function:: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst, const Stream& stream)

.. ocv:function:: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst)

.. ocv:function:: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst, const Stream& stream)

    Makes a multi-channel matrix out of several single-channel matrices.

    :param src: Array/vector of source matrices.

    :param n: Number of source matrices.

    :param dst: Destination matrix.

    :param stream: Stream for the asynchronous version.

.. seealso:: 
   :ocv:func:`merge` 

.. index:: gpu::split

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

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

.. ocv:function:: void gpu::split(const GpuMat& src, vector<GpuMat>& dst)

.. ocv:function:: void gpu::split(const GpuMat& src, vector<GpuMat>& dst, const Stream& stream)

    Copies each plane of a multi-channel matrix into an array.

    :param src: Source matrix.

    :param dst: Destination array/vector of single-channel matrices.

    :param stream: Stream for the asynchronous version.

.. seealso:: 
   :ocv:func:`split`

.. index:: gpu::magnitude

gpu::magnitude
------------------
.. ocv:function:: void gpu::magnitude(const GpuMat& xy, GpuMat& magnitude)

.. ocv:function:: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude)

.. ocv:function:: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream)

    Computes magnitudes of complex matrix elements.

    :param xy: Source complex matrix in the interleaved format (``CV_32FC2``).
    
    :param x: Source matrix containing real components (``CV_32FC1``).

    :param y: Source matrix containing imaginary components (``CV_32FC1``).

    :param magnitude: Destination matrix of float magnitudes (``CV_32FC1``).

    :param stream: Stream for the asynchronous version.

.. seealso::
   :ocv:func:`magnitude` 

.. index:: gpu::magnitudeSqr

gpu::magnitudeSqr
---------------------
.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& xy, GpuMat& magnitude)

.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude)

.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream)

    Computes squared magnitudes of complex matrix elements.

    :param xy: Source complex matrix in the interleaved format (``CV_32FC2``).

    :param x: Source matrix containing real components (``CV_32FC1``).

    :param y: Source matrix containing imaginary components (``CV_32FC1``).

    :param magnitude: Destination matrix of float magnitude squares (``CV_32FC1``).

    :param stream: Stream for the asynchronous version.

.. index:: gpu::phase

gpu::phase
--------------
.. ocv:function:: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees=false)

.. ocv:function:: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees, const Stream& stream)

    Computes polar angles of complex matrix elements.

    :param x: Source matrix containing real components (``CV_32FC1``).

    :param y: Source matrix containing imaginary components (``CV_32FC1``).

    :param angle: Destionation matrix of angles (``CV_32FC1``).

    :param angleInDegress: Flag for angles that must be evaluated in degress.

    :param stream: Stream for the asynchronous version.

.. seealso::
   :ocv:func:`phase` 

.. index:: gpu::cartToPolar

gpu::cartToPolar
--------------------
.. ocv:function:: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees=false)

.. ocv:function:: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees, const Stream& stream)

    Converts Cartesian coordinates into polar.

    :param x: Source matrix containing real components (``CV_32FC1``).

    :param y: Source matrix containing imaginary components (``CV_32FC1``).

    :param magnitude: Destination matrix of float magnitudes (``CV_32FC1``).

    :param angle: Destionation matrix of angles (``CV_32FC1``).

    :param angleInDegress: Flag for angles that must be evaluated in degress.

    :param stream: Stream for the asynchronous version.

.. seealso::
   :ocv:func:`cartToPolar` 

.. index:: gpu::polarToCart

gpu::polarToCart
--------------------
.. ocv:function:: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees=false)

.. ocv:function:: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, const Stream& stream)

    Converts polar coordinates into Cartesian.

    :param magnitude: Source matrix containing magnitudes (``CV_32FC1``).

    :param angle: Source matrix containing angles (``CV_32FC1``).

    :param x: Destination matrix of real components (``CV_32FC1``).

    :param y: Destination matrix of imaginary components (``CV_32FC1``).

    :param angleInDegress: Flag that indicates angles in degress.

    :param stream: Stream for the asynchronous version.

.. seealso::
   :ocv:func:`polarToCart`