Function mindspore::dataset::Divide

Function Documentation

bool mindspore::dataset::Divide(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)

Given image A and image B and calculate the division of them (A / B). This is an element by element operation.

Example
std::vector<uint8_t> mat1 = {8, 8, 8, 8};
LiteMat lite_mat_src;
lite_mat_src.Init(2, 2, 1, mat1.data(), LDataType::UINT8);

std::vector<uint8_t> mat2 = {2, 2, 2, 2};
LiteMat lite_mat_src2;
lite_mat_src2.Init(2, 2, 1, mat2.data(), LDataType::UINT8);

/* Calculate the division of images */
LiteMat div;
Divide(lite_mat_src, lite_mat_src2, &div);
for (int i = 0; i < div.height_; i++) {
  for (int j = 0; j < div.width_; j++) {
    std::cout << std::to_string(div.ptr<uint8_t>(i)[j]) << ", ";
  }
  std::cout << std::endl;
}

Parameters
  • src_a[in] Input image data.

  • src_b[in] Input image data.

  • dst[in] The division of input images.

Returns

Return true if transform successfully.