• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_MATH_UTILS_H_
17 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_MATH_UTILS_H_
18 
19 #include <memory>
20 #include <random>
21 #include <vector>
22 #include "minddata/dataset/util/status.h"
23 
24 #define CV_PI 3.1415926535897932384626433832795
25 
26 namespace mindspore {
27 namespace dataset {
28 
29 /// \brief Returns lower and upper pth percentiles of the input histogram.
30 /// \param[in] hist: Input histogram (mutates the histogram for computation purposes)
31 /// \param[in] hi_p: Right side percentile
32 /// \param[in] low_p: Left side percentile
33 /// \param[out] hi: Value at high end percentile
34 /// \param[out] lo: Value at low end percentile
35 Status ComputeUpperAndLowerPercentiles(std::vector<int32_t> *hist, int32_t hi_p, int32_t low_p, int32_t *hi,
36                                        int32_t *lo);
37 
38 /// \brief Converts degrees input to radians.
39 /// \param[in] degrees: Input degrees
40 /// \param[out] radians_target: Radians output
41 Status DegreesToRadians(float_t degrees, float_t *radians_target);
42 
43 /// \brief Generates a random real number in [a,b).
44 /// \param[in] a: Start of range
45 /// \param[in] b: End of range
46 /// \param[in] rnd: Random device
47 /// \param[out] result: Random number in range [a,b)
48 Status GenerateRealNumber(float_t a, float_t b, std::mt19937 *rnd, float_t *result);
49 
50 }  // namespace dataset
51 }  // namespace mindspore
52 #endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_MATH_UTILS_H_
53