mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 09:07:10 +08:00
[C# api] add c sharp api for fastdeploy (#1246)
* add c sharp api for fastdeploy * update accroding to c apis * add cmakelist for c sharp api * add cmakelists for c sharp * fix cmakelists * fix cmakelists * add c sharp api for fastdeploy * add ppyoloe demo * add ppyoloe demo * modify demo namespace code * add readme * fix format * format code * fix doc --------- Co-authored-by: heliqi <1101791222@qq.com>
This commit is contained in:
45
csharp/fastdeploy/vision/visualize.cs
Normal file
45
csharp/fastdeploy/vision/visualize.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using OpenCvSharp;
|
||||
using fastdeploy.types_internal_c;
|
||||
|
||||
namespace fastdeploy {
|
||||
namespace vision {
|
||||
|
||||
public class Visualize {
|
||||
|
||||
public static Mat VisDetection(Mat im, DetectionResult detection_result,
|
||||
float score_threshold = 0.0f,
|
||||
int line_size = 1, float font_size = 0.5f) {
|
||||
FD_DetectionResult fd_detection_result =
|
||||
ConvertResult.ConvertDetectionResultToCResult(detection_result);
|
||||
IntPtr result_ptr =
|
||||
FD_C_VisDetection(im.CvPtr, ref fd_detection_result, score_threshold,
|
||||
line_size, font_size);
|
||||
return new Mat(result_ptr);
|
||||
}
|
||||
|
||||
[DllImport("fastdeploy.dll", EntryPoint = "FD_C_VisDetection")]
|
||||
private static extern IntPtr
|
||||
FD_C_VisDetection(IntPtr im, ref FD_DetectionResult fd_detection_result,
|
||||
float score_threshold, int line_size, float font_size);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user