lapjv.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (c) 2021 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. // The code is based on:
  15. // https://github.com/gatagat/lap/blob/master/lap/lapjv.h
  16. // Ths copyright of gatagat/lap is as follows:
  17. // MIT License
  18. #ifndef LAPJV_H
  19. #define LAPJV_H
  20. #define LARGE 1000000
  21. #if !defined TRUE
  22. #define TRUE 1
  23. #endif
  24. #if !defined FALSE
  25. #define FALSE 0
  26. #endif
  27. #define NEW(x, t, n) if ((x = (t *)malloc(sizeof(t) * (n))) == 0) {return -1;}
  28. #define FREE(x) if (x != 0) { free(x); x = 0; }
  29. #define SWAP_INDICES(a, b) { int_t _temp_index = a; a = b; b = _temp_index; }
  30. #include <opencv2/opencv.hpp>
  31. namespace PaddleDetection {
  32. typedef signed int int_t;
  33. typedef unsigned int uint_t;
  34. typedef double cost_t;
  35. typedef char boolean;
  36. typedef enum fp_t { FP_1 = 1, FP_2 = 2, FP_DYNAMIC = 3 } fp_t;
  37. int lapjv_internal(
  38. const cv::Mat &cost, const bool extend_cost, const float cost_limit,
  39. int *x, int *y);
  40. } // namespace PaddleDetection
  41. #endif // LAPJV_H