Skip to content

Commit af0c6cc

Browse files
Made input image const to be in align with the ed sensor integration application
1 parent 237a2c0 commit af0c6cc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

inc/yolo_inference.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ class YOLO_V8
6666
public:
6767
const char* CreateSession(DL_INIT_PARAM& iParams);
6868

69-
const char* RunSession(cv::Mat& iImg, std::vector<DL_RESULT>& oResult);
69+
const char* RunSession(const cv::Mat& iImg, std::vector<DL_RESULT>& oResult);
7070

7171
char* WarmUpSession();
7272

7373
template<typename N>
74-
char* TensorProcess(clock_t& starttime_1, cv::Mat& iImg, N& blob, std::vector<int64_t>& inputNodeDims,
74+
char* TensorProcess(clock_t& starttime_1, const cv::Mat& iImg, N& blob, std::vector<int64_t>& inputNodeDims,
7575
std::vector<DL_RESULT>& oResult);
7676

77-
char* PreProcess(cv::Mat& iImg, std::vector<int> iImgSize, cv::Mat& oImg);
77+
char* PreProcess(const cv::Mat& iImg, std::vector<int> iImgSize, cv::Mat& oImg);
7878

7979
std::vector<std::string> classes{};
8080

src/yolo_inference.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Ort
2424
// Definition: Flattened image to blob (and normalizaed) for deep learning inference. Also reorganize from HWC to CHW.
2525
// Note: Not in the header file since it is not used outside of this file.
2626
template<typename T>
27-
char* BlobFromImage(cv::Mat& iImg, T& iBlob) {
27+
char* BlobFromImage(const cv::Mat& iImg, T& iBlob) {
2828
int channels = iImg.channels();
2929
int imgHeight = iImg.rows;
3030
int imgWidth = iImg.cols;
@@ -44,7 +44,7 @@ char* BlobFromImage(cv::Mat& iImg, T& iBlob) {
4444
}
4545

4646

47-
char* YOLO_V8::PreProcess(cv::Mat& iImg, std::vector<int> iImgSize, cv::Mat& oImg)
47+
char* YOLO_V8::PreProcess(const cv::Mat& iImg, std::vector<int> iImgSize, cv::Mat& oImg)
4848
{
4949
if (iImg.channels() == 3)
5050
{
@@ -169,7 +169,7 @@ const char* YOLO_V8::CreateSession(DL_INIT_PARAM& iParams) {
169169
}
170170

171171

172-
const char* YOLO_V8::RunSession(cv::Mat& iImg, std::vector<DL_RESULT>& oResult) {
172+
const char* YOLO_V8::RunSession(const cv::Mat& iImg, std::vector<DL_RESULT>& oResult) {
173173
#ifdef benchmark
174174
clock_t starttime_1 = clock();
175175
#endif // benchmark
@@ -199,7 +199,7 @@ const char* YOLO_V8::RunSession(cv::Mat& iImg, std::vector<DL_RESULT>& oResult)
199199

200200

201201
template<typename N>
202-
char* YOLO_V8::TensorProcess(clock_t& starttime_1, cv::Mat& iImg, N& blob, std::vector<int64_t>& inputNodeDims,
202+
char* YOLO_V8::TensorProcess(clock_t& starttime_1, const cv::Mat& iImg, N& blob, std::vector<int64_t>& inputNodeDims,
203203
std::vector<DL_RESULT>& oResult) {
204204
Ort::Value inputTensor = Ort::Value::CreateTensor<typename std::remove_pointer<N>::type>(
205205
Ort::MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeCPU), blob, 3 * imgSize.at(0) * imgSize.at(1),

0 commit comments

Comments
 (0)