postprocess.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <vector>
  16. struct READ_RESULT {
  17. // the number of scales
  18. int scale_num;
  19. // the pointer location relative to the scales
  20. float scales;
  21. // the ratio between from the pointer to the starting scale and
  22. // distance from the ending scale to the starting scale
  23. float ratio;
  24. };
  25. void creat_line_image(const std::vector<int64_t> &seg_image,
  26. std::vector<unsigned char> *output);
  27. void convert_1D_data(const std::vector<unsigned char> &line_image,
  28. std::vector<unsigned int> *scale_data,
  29. std::vector<unsigned int> *pointer_data);
  30. void scale_mean_filtration(const std::vector<unsigned int> &scale_data,
  31. std::vector<unsigned int> *scale_mean_data);
  32. void get_meter_reader(const std::vector<unsigned int> &scale,
  33. const std::vector<unsigned int> &pointer,
  34. READ_RESULT *result);
  35. void read_process(const std::vector<std::vector<int64_t>> &seg_image,
  36. std::vector<READ_RESULT> *read_results,
  37. const int thread_num);