C3032
2025-12-20 38c333f8091e5062be0bbdd81960315ebce69008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using static SmartScanner.IDViewerDefines;
using System.IO;
using System.Drawing;
 
namespace SmartScanner
{
    class IDViewerSDK2
    {
        [DllImport("yolov8_ov_infer.dll", EntryPoint = "CreateDetector_CPU", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr CreateDetector_CPU();
 
        [DllImport("yolov8_ov_infer.dll", EntryPoint = "InitializeDetector_CPU", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern bool InitializeDetector_CPU(IntPtr m_yolov8, string device_char, string model_path_char);
        [DllImport("yolov8_ov_infer.dll", EntryPoint = "PredictDetector_CPU", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern void PredictDetector_CPU(IntPtr m_yolov8,
            byte[] image_batch,
            float[] x1_ptr,
            float[] y1_ptr,
            float[] x2_ptr,
            float[] y2_ptr,
            float[] prob_ptr,
            int[] class_ptr,
            int[] num_boxes,
            int buffer_size,
            int width,
            int height,
            int batch_size,
            float conf_thresh,
            float nms_thres,
            int is_Saved,
            int sequence);
 
        [DllImport("yolov8_ov_infer.dll", EntryPoint = "DisposeDetector_CPU", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern void DisposeDetector_CPU(IntPtr m_yolov8);
 
        [DllImport("yolov8_ov_infer.dll", EntryPoint = "ConvertSingletoThreeChannels", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern void ConvertSingletoThreeChannels(IntPtr m_yolov8, byte[] input, int width, int height, byte[] output);
 
 
        //OPT提供的C++SDK
        [DllImport("optSDK.dll", EntryPoint = "IDImage_Create", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr IDImage_Create();
        [DllImport("IDViewerSDK.dll", EntryPoint = "IDImage", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern long IDImage(byte[] srcImageData, int step, int rows, int cols, int channel, IDImageType depth);
        [DllImport("IDViewerSDK.dll", EntryPoint = "captureImage", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern long captureImage(IntPtr image);
    }
}