video_preprocess_common.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*************************************************************************
  2. * Copyright (C) [2021] by Cambricon, Inc. All rights reserved
  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. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  15. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. * THE SOFTWARE.
  19. *************************************************************************/
  20. #ifndef SAMPLES_DEMO_PREPROCESS_VIDEO_PREPROCESS_COMMON_HPP_
  21. #define SAMPLES_DEMO_PREPROCESS_VIDEO_PREPROCESS_COMMON_HPP_
  22. #include "opencv2/highgui/highgui.hpp"
  23. #include "opencv2/imgproc/imgproc.hpp"
  24. #if (CV_MAJOR_VERSION >= 3)
  25. #include "opencv2/imgcodecs/imgcodecs.hpp"
  26. #endif
  27. #include "cnis/contrib/video_helper.h"
  28. #include "cnstream_frame_va.hpp"
  29. using VideoPixelFmt = infer_server::video::PixelFmt;
  30. bool ConvertColorSpace(size_t width, size_t height, VideoPixelFmt src_fmt, VideoPixelFmt dst_fmt,
  31. uint8_t* src_img_data, cv::Mat* dst_img);
  32. #endif // ifndef SAMPLES_DEMO_PREPROCESS_VIDEO_PREPROCESS_COMMON_HPP_