Function opencv::core::hconcat

source ·
pub fn hconcat(
    src: &impl ToInputArray,
    dst: &mut impl ToOutputArray
) -> Result<()>
Expand description

Applies horizontal concatenation to given matrices.

The function horizontally concatenates two or more cv::Mat matrices (with the same number of rows).

   cv::Mat matArray[] = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
                           cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
                           cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
 
   cv::Mat out;
   cv::hconcat( matArray, 3, out );
   //out:
   //[1, 2, 3;
   // 1, 2, 3;
   // 1, 2, 3;
   // 1, 2, 3]

§Parameters

  • src: input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
  • nsrc: number of matrices in src.
  • dst: output array. It has the same number of rows and depth as the src, and the sum of cols of the src.

§See also

cv::vconcat(const Mat*, size_t, OutputArray), cv::vconcat(InputArrayOfArrays, OutputArray) and cv::vconcat(InputArray, InputArray, OutputArray)

§Overloaded parameters

  std::vector<cv::Mat> matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
                                     cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
                                     cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};

  cv::Mat out;
  cv::hconcat( matrices, out );
  //out:
  //[1, 2, 3;
  // 1, 2, 3;
  // 1, 2, 3;
  // 1, 2, 3]
  • src: input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
  • dst: output array. It has the same number of rows and depth as the src, and the sum of cols of the src. same depth.