FastDeploy  latest
Fast & Easy to Deploy!
color_space_convert.h
1 // Copyright (c) 2022 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 
15 #pragma once
16 
17 #include "fastdeploy/vision/common/processors/base.h"
18 
19 namespace fastdeploy {
20 namespace vision {
21 
24 class FASTDEPLOY_DECL BGR2RGB : public Processor {
25  public:
26  bool ImplByOpenCV(FDMat* mat);
27 #ifdef ENABLE_FLYCV
28  bool ImplByFlyCV(FDMat* mat);
29 #endif
30  virtual std::string Name() { return "BGR2RGB"; }
31 
38  static bool Run(FDMat* mat, ProcLib lib = ProcLib::DEFAULT);
39 };
40 
43 class FASTDEPLOY_DECL RGB2BGR : public Processor {
44  public:
45  bool ImplByOpenCV(FDMat* mat);
46 #ifdef ENABLE_FLYCV
47  bool ImplByFlyCV(FDMat* mat);
48 #endif
49  std::string Name() { return "RGB2BGR"; }
50 
57  static bool Run(FDMat* mat, ProcLib lib = ProcLib::DEFAULT);
58 };
59 
62 class FASTDEPLOY_DECL BGR2GRAY : public Processor {
63  public:
64  bool ImplByOpenCV(FDMat* mat);
65 #ifdef ENABLE_FLYCV
66  bool ImplByFlyCV(FDMat* mat);
67 #endif
68  virtual std::string Name() { return "BGR2GRAY"; }
69 
76  static bool Run(FDMat* mat, ProcLib lib = ProcLib::DEFAULT);
77 };
78 
81 class FASTDEPLOY_DECL RGB2GRAY : public Processor {
82  public:
83  bool ImplByOpenCV(FDMat* mat);
84 #ifdef ENABLE_FLYCV
85  bool ImplByFlyCV(FDMat* mat);
86 #endif
87  std::string Name() { return "RGB2GRAY"; }
88 
95  static bool Run(FDMat* mat, ProcLib lib = ProcLib::DEFAULT);
96 };
97 
98 
99 } // namespace vision
100 } // namespace fastdeploy
Processor for tansform images from RGB to BGR.
Definition: color_space_convert.h:43
Processor for tansform images from BGR to RGB.
Definition: color_space_convert.h:24
FDMat is a structure for replace cv::Mat.
Definition: mat.h:34
Processor base class for processors in fastdeploy/vision/common/processors.
Definition: base.h:42
Processor for tansform images from RGB to GRAY.
Definition: color_space_convert.h:81
Processor for tansform images from BGR to GRAY.
Definition: color_space_convert.h:62
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16