Function mindspore::dataset::Conv2D
Defined in File image_process.h
Function Documentation
-
bool mindspore::dataset::Conv2D(const LiteMat &src, const LiteMat &kernel, LiteMat &dst, LDataType dst_type, PaddBorderType pad_type = PaddBorderType::PADD_BORDER_DEFAULT)
Apply a 2D convolution over the image.
- Example
/* Assume p_rgb is a pointer that points to an image with shape (width, height, channel) */ LiteMat lite_mat_src(width, height, channel, (void *)p_rgb, LDataType::UINT8); LiteMat lite_mat_dst; LiteMat kernel; kernel.Init(3, 3, 1, LDataType::FLOAT32); float *kernel_ptr = kernel; for (int i = 0; i < 9; i++) { kernel_ptr[i] = i % 2; } Conv2D(lite_mat_src, kernel, lite_mat_dst, LDataType::UINT8); std::cout << lite_mat_dst.width_ << " " << lite_mat_dst.height_ << " " << lite_mat_dst.channel_ << std::endl;
- Parameters
src – [in] LiteMat image to be processed. Only LiteMat of type UINT8 and FLOAT32 is supported now.
kernel – [in] LiteMat 2D convolutionkernel. Only LiteMat of type FLOAT32 is supported now.
dst – [in] LiteMat image after processing.
dst_type – [in] Output data type of dst.
pad_type – [in] The padding type used while filtering (default=PaddBorderType::PADD_BORDER_DEFAULT).
- Returns
Return true if transform successfully.