I need help understanding cv :: mixChannels

I made some corrections to the cv :: mixChannels documentation as shown. but I think there are some corrections needed to describe the parameters.

for example, the description fromTofor const int* fromToand const std::vector<int>& fromTois the same.

CV_EXPORTS void mixChannels(const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts,
                        const int* fromTo, size_t npairs);
CV_EXPORTS void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
                        const int* fromTo, size_t npairs);
CV_EXPORTS_W void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
                               const std::vector<int>& fromTo);

Parameters
    src ...
    dst ....
    fromTo  array of index pairs specifying which channels are copied and where; fromTo[k*2]
    is a 0-based index of the input channel in src, fromTo[k*2+1] is an index of the output
    channel in dst; the continuous channel numbering is used: the first input image channels
    are indexed from 0 to src[0].channels()-1, the second input image channels are indexed
    from src[0].channels() to src[0].channels() + src[1].channels()-1, and so on, the same
    scheme is used for the output image channels; as a special case, when fromTo[k*2] is
    negative, the corresponding output channel is filled with zero . 

I need help on this.

Any help would be appreciated.

+4
source share
2 answers

Why did you change the "array or matrix vector" to just "the matrix array"?

As for the argument fromTo, I will try to expand this paragraph.

array of index pairs specifying which channels are copied and where;

[In, Out, In, Out, In, Out,...]. , . .

fromTo[k*2] is a 0-based index of the input channel in src,
fromTo[k*2+1] is an index of the output channel in dst; 

, fromTo , .

the continuous channel numbering is used: the first input image channels
are indexed from 0 to src[0].channels()-1, the second input image
channels are indexed from 
src[0].channels() to src[0].channels() + src[1].channels()-1, and so on, 

. , , . src[0] - , src[1] - .

, : 0, 1, 2, 3, 4, 5. , 0, 1, 2 ( "0 to src[0].channels()-1" ), 3, 4, 5 ( "src[0].channels()" (.. 3) "to src[0].channels() + src[1].channels()-1" (.. 3 + 3 - 1 = 5))

, .

the same scheme is used for the output image channels; 

, .

as a special case, when fromTo[k*2] is negative, 
the corresponding output channel is filled with zero .

/, - -1, 3, , 3, .

+4

. -, :

.

, , fromTo const std::vector<Vec2i> ( ), . .


Chatty

- :

fromTo: , , . src, dst. , . ..

- :

fromTo: \[ from^{0}_{0}, to^{0}_{0}, ... from^{0}_{src[0].channels()-1}, to^{0}_{src[0].channels()-1}, ..., from^{i}_{j}, to^{i}_{j}, ... \], :

  • from -
  • to -
  • - src dst,
  • j - , 0 src [i].channels() - 1

, .


...: D

+1

Source: https://habr.com/ru/post/1617130/


All Articles