diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/CMakeLists.txt index 5c85ef418a..8a3dc3e320 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/CMakeLists.txt @@ -1,8 +1,8 @@ file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc") set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD) add_library(lite-cv OBJECT - image_process.cc - warp_affine.cc - gaussian_blur.cc - canny.cc - lite_mat.cc) \ No newline at end of file + canny.cc + gaussian_blur.cc + image_process.cc + lite_mat.cc + warp_affine.cc) \ No newline at end of file diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/canny.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/canny.cc index 1c165fc28e..eb5b9419f9 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/canny.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/canny.cc @@ -98,7 +98,7 @@ bool Sobel(const LiteMat &src, LiteMat &dst, int flag_x, int flag_y, int ksize, return ConvRowCol(src, kx, ky, dst, LDataType::FLOAT32, pad_type); } -static float GetEdge(const float *temp, int width, int height, int x, int y) { +static float GetEdge(const std::vector &temp, int width, int height, int x, int y) { if (x >= 0 && y >= 0 && x < width && y < height) { return temp[y * width + x]; } else { @@ -114,7 +114,7 @@ static void NonMaximumSuppression(const LiteMat &gx, const LiteMat &gy, LiteMat float *edges_ptr = edges; int size = gx.height_ * gx.width_; - float *temp = new float[size]; + std::vector temp(size); for (int i = 0; i < size; i++) { float gx_value = gx_ptr[i]; float gy_value = gy_ptr[i]; @@ -177,9 +177,9 @@ static void Hysteresis(const LiteMat &edges, uint8_t *dst, double low_thresh, do uint8_t *dst_ptr = dst; int size = edges.height_ * edges.width_; - int *buffer = new int[size]; - int buffer_step = edges.width_; std::vector stack; + std::vector buffer(size); + int buffer_step = edges.width_; for (int y = 0; y < edges.height_; y++) { for (int x = 0; x < edges.width_; x++) { int pos = y * edges.width_ + x;