Image processing method, device and equipment based on SDK (Software Development Kit) interface
By introducing an algorithm integration library into the vision algorithm package SDK library and encapsulating common interfaces using preset interface specifications, the compilation and runtime conflicts of the vision algorithm package SDK library are resolved, achieving dynamic extensibility and scalability, and reducing the development and maintenance burden.
Patent Information
- Application Number
- CN202511623772.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-03-13
AI Technical Summary
In machine vision software systems, vision algorithm SDK libraries contain compilation and runtime conflicts, which prevent them from achieving dynamic scalability and extensibility, leading to difficulties in development and maintenance.
By introducing an algorithm integration library into the visual algorithm package SDK library and encapsulating public interfaces using preset interface specifications, the mapping between the SDK interface and the algorithm integration library is realized, supporting dynamic extensibility and scalability, and isolating modifications to visual image processing algorithms.
It significantly reduces compilation and runtime conflicts, alleviates the development and maintenance burden, achieves scalability and extensibility of the vision algorithm package SDK library, and ensures the localization of the impact of modifications.
Smart Images

Figure CN121657997A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine vision technology, and in particular to an image processing method, apparatus and device based on an SDK interface. Background Technology
[0002] In machine vision software systems, the captured target can be converted into an image signal by a camera, and the image signal can be sent to an image processing device. The image processing device performs various operations on the image signal based on the pixel distribution and information such as brightness and color in the image signal to extract the features of the target, and then obtains the image processing result.
[0003] In machine vision software systems, different scenarios require the combined use of multiple visual image processing algorithms. To meet the needs of multiple scenarios, a visual algorithm package SDK (Software Development Kit) library can be developed. The visual algorithm package SDK library will integrate multiple visual image processing algorithms and provide a unified and standardized interface for users to perform secondary development, thereby shortening the project development cycle.
[0004] However, when integrating multiple visual image processing algorithms through the visual algorithm package SDK library, since different visual image processing algorithms are completed by different developers, there will be certain differences in quality and delivery cycle among different developers. Therefore, the visual algorithm package SDK library has problems such as compilation conflicts and runtime conflicts, and the visual algorithm package SDK library does not support dynamic extensibility and dynamic scalability. Summary of the Invention
[0005] This application provides an image processing method based on an SDK interface, the method comprising: Identify the target algorithm integration library corresponding to the interface identifier of the target SDK interface; wherein, the target algorithm integration library includes visual image processing algorithms and a public interface encapsulated according to a preset interface specification, the public interface being used to implement the mapping between the target SDK interface and the target algorithm integration library; wherein, the function of the target SDK interface is determined based on the visual processing capabilities supported by the target algorithm integration library; The visual image processing algorithm in the target algorithm integration library is invoked to process the image to be processed.
[0006] This application provides a visual algorithm package SDK library, which includes: an SDK interface layer, an SDK framework layer, and an algorithm integration layer; wherein: The algorithm integration layer includes multiple algorithm integration libraries, which include visual image processing algorithms and public interfaces encapsulated according to preset interface specifications; wherein, the public interfaces are used to implement the mapping between SDK interfaces and the algorithm integration libraries; The SDK interface layer includes multiple SDK interfaces, and each SDK interface corresponds to an algorithm integration library in the algorithm integration layer; wherein, the function of each SDK interface is determined based on the visual processing capabilities supported by the corresponding algorithm integration library. The SDK framework layer determines the target algorithm integration library corresponding to the interface identifier of the target SDK interface; and calls the visual image processing algorithm in the target algorithm integration library to process the image to be processed.
[0007] This application provides an image processing apparatus based on an SDK interface, the apparatus comprising: The determination module is used to determine the target algorithm integration library corresponding to the interface identifier of the target SDK interface; the target algorithm integration library includes visual image processing algorithms and a public interface encapsulated according to a preset interface specification, the public interface is used to realize the mapping between the target SDK interface and the target algorithm integration library; the function of the target SDK interface is determined based on the visual processing capabilities supported by the target algorithm integration library. The processing module is used to call the visual image processing algorithm in the target algorithm integration library and process the image to be processed through the visual image processing algorithm.
[0008] This application provides an electronic device, including: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the image processing method based on the SDK interface described above.
[0009] This application provides a computer program product, including a computer program that, when executed by a processor, implements the image processing method based on the SDK interface described above.
[0010] This application provides a machine-readable storage medium that can store machine-executable instructions that can be executed by a processor; wherein the processor is used to execute the machine-executable instructions to implement the image processing method based on the SDK interface described in the above example of this application.
[0011] As can be seen from the above technical solutions, in this embodiment of the application, the algorithm integration library includes visual image processing algorithms and a public interface encapsulated according to a preset interface specification. That is, a public interface is encapsulated for visual image processing algorithms. This public interface meets the configured interface specification and the predefined specification standard. It can standardize the algorithm integration library through the public interface, that is, the calling process of all algorithm integration libraries is consistent. It realizes the ability to dynamically expand and delete the algorithm integration library, so that the visual algorithm package SDK library has scalability and extensibility, and greatly reduces the investment in product development and maintenance.
[0012] When integrating a large number of algorithm integration libraries, this approach significantly reduces compilation and runtime conflicts caused by developer skills, development quality, and delivery cycles. It achieves decoupling between the SDK interface and the visual image processing algorithms. The SDK interface only needs to create a corresponding SDK interface object instance through the framework layer based on the interface identifier, and algorithm calls can be completed through this instance. Updates to the algorithm integration library will not affect the SDK interface or the main framework, thus limiting the impact to a localized area and isolating modifications to the visual image processing algorithms (which would affect updates to the algorithm integration library).
[0013] Supports dynamic scalability: When integrating new algorithm libraries, after encapsulating visual image processing algorithms according to predefined specifications to form an algorithm library, the processing capabilities of the algorithm library can be dynamically resolved, thereby completing capability expansion and achieving dynamic scalability. Supports dynamic extensibility: Problematic algorithm libraries can be removed without affecting the operation of other algorithm libraries, achieving dynamic extensibility. Dynamic extensibility can resolve compilation and runtime conflicts, achieving the effect of isolating modifications. By deleting algorithm libraries involved in unnecessary functions, disk usage can be reduced, minimizing the runtime environment. The highly scalable and extensible design reduces the development and maintenance burden on technical personnel. Attached Figure Description
[0014] Figure 1 This is a flowchart of an image processing method based on an SDK interface according to one embodiment of this application; Figure 2 This is a schematic diagram illustrating the problems faced by the visual algorithm package SDK library in one embodiment of this application; Figure 3A This is a schematic diagram illustrating the dynamic scalability in one embodiment of this application; Figure 3B This is a schematic diagram illustrating dynamic scalability in one embodiment of this application; Figure 4 This is a schematic diagram of an image processing method based on an SDK interface according to one embodiment of this application; Figure 5 This is a flowchart illustrating a method for managing an algorithm integration library according to one embodiment of this application; Figure 6 This is a flowchart of an image processing method based on an SDK interface according to one embodiment of this application; Figure 7 This is a schematic diagram of the public interface of the algorithm integration library in one embodiment of this application; Figure 8 This is a schematic diagram of the calling process in one embodiment of this application; Figure 9A This is a structural diagram of an image processing apparatus based on an SDK interface according to one embodiment of this application; Figure 9B This is a hardware structure diagram of an electronic device according to one embodiment of this application. Detailed Implementation
[0015] This application proposes an image processing method based on an SDK interface, which can be applied to electronic devices. See [link to relevant documentation]. Figure 1 The diagram shown is a flowchart of the method, which may include: Step 101: Determine the target algorithm integration library corresponding to the interface identifier of the target SDK interface; wherein, the target algorithm integration library includes visual image processing algorithms and public interfaces encapsulated according to preset interface specifications (i.e., public interfaces encapsulated for visual image processing algorithms); wherein, the public interfaces are used to realize the mapping between the target SDK interface and the target algorithm integration library; wherein, the function of the target SDK interface is determined based on the visual processing capabilities supported by the target algorithm integration library.
[0016] Step 102: Call the visual image processing algorithm in the target algorithm integration library to process the image to be processed.
[0017] For example, the public interface includes a first type of public interface, which is used to query the visual processing capabilities supported by the target algorithm integration library. Based on this, the first type of public interface can be used to query the visual processing capabilities supported by the target algorithm integration library. For instance, the first type of public interface can be used to query a list of processing capabilities of the target algorithm integration library, which may include the visual processing capabilities supported by the target algorithm integration library; such as the target algorithm integration library supporting at least one visual processing capability.
[0018] For example, the visual processing capabilities supported by the target algorithm integration library include at least one of the following: localization, recognition, measurement, defect detection, deep learning, edge learning, image preprocessing, calibration, and alignment. The functions of the target SDK interface corresponding to the target algorithm integration library include at least one of the following: localization, recognition, measurement, defect detection, deep learning, edge learning, image preprocessing, calibration, and alignment. For instance, if the visual processing capability supported by the target algorithm integration library is localization, then the function of the target SDK interface corresponding to the target algorithm integration library is localization; or, if the visual processing capability supported by the target algorithm integration library is recognition, then the function of the target SDK interface corresponding to the target algorithm integration library is recognition; or, if the visual processing capability supported by the target algorithm integration library is measurement, then the function of the target SDK interface corresponding to the target algorithm integration library is measurement. Of course, the above are just a few examples and are not intended to be limiting.
[0019] For example, the public interface includes a second type of public interface, which is used to create an instance object of the target algorithm integration library. Based on this, an instance object of the target algorithm integration library is created through the second type of public interface. The object identifier of this integration library instance object corresponds to the interface identifier of the target SDK interface, and the object identifier of the integration library instance object corresponds to the target algorithm integration library, thus establishing a correspondence between the target SDK interface and the target algorithm integration library.
[0020] For example, after querying the visual processing capabilities supported by the target algorithm integration library through the first type of public interface, the first mapping relationship between the SDK interface object instance and the target algorithm integration library is recorded; when creating an SDK interface object instance for the target SDK interface, the target algorithm integration library corresponding to the SDK interface object instance is obtained by reading the first mapping relationship; based on this, an integration library instance object of the target algorithm integration library is created through the second type of public interface of the target algorithm integration library, and the second mapping relationship between the interface identifier of the target SDK interface and the object identifier of the integration library instance object is recorded.
[0021] For example, SDK interfaces are predefined and static (like .h header files in C++). When calling an SDK interface, it's necessary to create an SDK interface object instance corresponding to the target algorithm integration library (i.e., the SDK interface corresponding to the target algorithm integration library becomes the target SDK interface). This SDK interface object instance can be a handle value. For instance, a handle value can be created first through the SDK interface and associated with the algorithm integration library. When calling the SDK interface, this handle value is passed in, enabling dynamic calls to the algorithm integration library. This handle value can be understood as a corresponding SDK interface object instance. Therefore, after querying the visual processing capabilities supported by the target algorithm integration library through the first type of public interface, an SDK interface object instance corresponding to the target SDK interface of the target algorithm integration library can be created.
[0022] For example, determining the target algorithm integration library corresponding to the interface identifier of the target SDK interface may include, but is not limited to: querying the second mapping relationship based on the interface identifier of the target SDK interface to obtain the object identifier of the integration library instance object corresponding to the interface identifier of the target SDK interface; based on this, the target algorithm integration library may be determined based on the object identifier of the integration library instance object.
[0023] For example, the public interface includes a third type of public interface, which is used to destroy the instance object of the target algorithm integration library. Based on this, the instance object of the target algorithm integration library is destroyed through the third type of public interface to stop the processing of the image by calling the target algorithm integration library through the destroyed instance object.
[0024] For example, calling a visual image processing algorithm in the target algorithm integration library to process the image to be processed may include, but is not limited to: if there are no operation parameters for the image to be processed, the visual image processing algorithm in the target algorithm integration library can be called to process the image to be processed by running the visual image processing algorithm with default parameters; if there are operation parameters for the image to be processed, the visual image processing algorithm in the target algorithm integration library can be called to process the image to be processed by running the visual image processing algorithm with the operation parameters.
[0025] For example, when adding a new first algorithm integration library, the visual processing capabilities supported by the first algorithm integration library are queried through the first type of public interface of the first algorithm integration library to be added, and the mapping relationship between the first SDK interface object instance and the first algorithm integration library is recorded, with the first SDK interface object instance corresponding to the visual processing capability; a first SDK interface object instance is created for the first SDK interface of the SDK interface layer, and the first algorithm integration library corresponding to the first SDK interface object instance is obtained by reading the mapping relationship; an integration library instance object of the first algorithm integration library is created through the second type of public interface of the first algorithm integration library, and the mapping relationship between the interface identifier of the first SDK interface and the object identifier of the integration library instance object is recorded, with the object identifier of the integration library instance object corresponding to the first algorithm integration library.
[0026] For example, when deleting an existing second algorithm integration library, when destroying the second SDK interface object instance for the second SDK interface of the SDK interface layer, the first algorithm integration library corresponding to the second SDK interface object instance is obtained by reading the mapping relationship (i.e., the mapping relationship between the SDK interface object instance and the algorithm integration library); the integration library instance object of the second algorithm integration library is destroyed through the third type of public interface of the second algorithm integration library, and the second algorithm integration library is destroyed after the integration library instance object is destroyed.
[0027] This application proposes a visual algorithm package SDK library, which may include: an SDK interface layer, an SDK framework layer, and an algorithm integration layer. The algorithm integration layer may include multiple algorithm integration libraries, each containing visual image processing algorithms and a common interface encapsulated according to a preset interface specification. The common interface is used to map SDK interfaces to algorithm integration libraries. The SDK interface layer may include multiple SDK interfaces, each corresponding to an algorithm integration library in the algorithm integration layer. The function of each SDK interface is determined based on the visual processing capabilities supported by the corresponding algorithm integration library. The SDK framework layer can determine the target algorithm integration library corresponding to the interface identifier of the target SDK interface and call the visual image processing algorithm within the target algorithm integration library to process the image to be processed.
[0028] For example, the public interface includes a first type of public interface, which is used to query the visual processing capabilities supported by the target algorithm integration library. The SDK framework layer queries the visual processing capabilities supported by the target algorithm integration library through the first type of public interface. Alternatively, the public interface includes a second type of public interface, which is used to create an integration library instance object of the target algorithm integration library. The SDK framework layer creates the integration library instance object of the target algorithm integration library through the second type of public interface. The object identifier of the integration library instance object corresponds to the interface identifier of the target SDK interface, and the object identifier of the integration library instance object corresponds to the target algorithm integration library. Alternatively, after querying the visual processing capabilities supported by the target algorithm integration library through the first type of public interface, the SDK framework layer records the first mapping relationship between the SDK interface object instance and the target algorithm integration library. When the SDK interface layer creates an SDK interface object instance for the target SDK interface, the SDK framework layer obtains the target algorithm integration library corresponding to the SDK interface object instance by reading the first mapping relationship. The SDK framework layer creates an integration library instance object of the target algorithm integration library through the second type of public interface of the target algorithm integration library and records the second mapping relationship between the interface identifier of the target SDK interface and the object identifier of the integration library instance object. Alternatively, the public interface includes a third type of public interface, and the third type of public interface is used to destroy the integration library instance object of the target algorithm integration library. The SDK framework layer destroys the integration library instance object of the target algorithm integration library through the third type of public interface to stop calling the target algorithm integration library to process the image to be processed through the destroyed integration library instance object.
[0029] As can be seen from the above technical solutions, in this embodiment of the application, the algorithm integration library includes visual image processing algorithms and a public interface encapsulated according to a preset interface specification. That is, a public interface is encapsulated for visual image processing algorithms. This public interface meets the configured interface specification and the predefined specification standard. It can standardize the algorithm integration library through the public interface, that is, the calling process of all algorithm integration libraries is consistent. It realizes the ability to dynamically expand and delete the algorithm integration library, so that the visual algorithm package SDK library has scalability and extensibility, and greatly reduces the investment in product development and maintenance.
[0030] When integrating a large number of algorithm integration libraries, this approach significantly reduces compilation and runtime conflicts caused by developer skills, development quality, and delivery cycles. It achieves decoupling between the SDK interface and the visual image processing algorithms. The SDK interface only needs to create a corresponding SDK interface object instance through the framework layer based on the interface identifier, and algorithm calls can be completed through this instance. Updates to the algorithm integration library will not affect the SDK interface or the main framework, thus limiting the impact to a localized area and isolating modifications to the visual image processing algorithms (which would affect updates to the algorithm integration library).
[0031] Supports dynamic scalability: When integrating new algorithm libraries, after encapsulating visual image processing algorithms according to predefined specifications to form an algorithm library, the processing capabilities of the algorithm library can be dynamically resolved, thereby completing capability expansion and achieving dynamic scalability. Supports dynamic extensibility: Problematic algorithm libraries can be removed without affecting the operation of other algorithm libraries, achieving dynamic extensibility. Dynamic extensibility can resolve compilation and runtime conflicts, achieving the effect of isolating modifications. By deleting algorithm libraries involved in unnecessary functions, disk usage can be reduced, minimizing the runtime environment. The highly scalable and extensible design reduces the development and maintenance burden on technical personnel.
[0032] The technical solutions described above in the embodiments of this application will be explained below in conjunction with specific application scenarios.
[0033] In machine vision software systems, different scenarios often require the combined use of multiple visual image processing algorithms (also known as image processing algorithms). To meet the needs of various scenarios, a visual algorithm package SDK library can be developed. This library integrates multiple visual image processing algorithms and provides unified and standardized interfaces for users to perform secondary development, thereby shortening the project development cycle. The visual algorithm package SDK library is provided in the form of .dll (or .so) files, offering standardized interfaces to the outside world.
[0034] Because different visual image processing algorithms are developed by different developers, there are certain differences in quality and delivery cycle. Therefore, integrating multiple visual image processing algorithms through the visual algorithm package SDK library faces the following problems: Compilation conflicts: Different visual image processing algorithms may have the same definitions in their library header files, or static libraries of different visual image processing algorithms may export function implementations with the same name, causing compilation errors. Runtime conflicts: When using static linking, different visual image processing algorithms may simultaneously statically link different versions of common function libraries, causing potential runtime malfunctions. Inability to isolate modifications: When a visual image processing algorithm is updated, it cannot be guaranteed that the modification's impact is limited to a local area. When problems occur, it is impossible to accurately locate the problem, making it impossible to isolate modifications. Inability to maintain openness: When a new visual image processing algorithm is added, it affects the main structure of the visual algorithm package SDK library, making it impossible to maintain openness.
[0035] For example, SDK refers to Software Development Kit, a collection of development tools such as software packages, software frameworks, hardware platforms, and operating systems provided by software engineers for specific functions. Secondary development refers to the process of extending, customizing, or optimizing the functions and interfaces provided by the SDK according to specific needs. A .dll file is short for Dynamic Link Library, a library containing code and data that can be used by multiple programs simultaneously. A .so file is a Shared Object file, a type of dynamic link library containing reusable code and data that can be shared among multiple programs. Static linking is a process that embeds the required library code directly into the executable file during the program compilation and linking stages. Unlike dynamic linking, statically linked library code is directly integrated into the final executable file, rather than being dynamically loaded at runtime.
[0036] See Figure 2 The diagram illustrates the problems faced by a visual algorithm package SDK library. When integrating multiple visual image processing algorithms (such as visual image processing algorithm A, visual image processing algorithm B, ..., visual image processing algorithm N, etc.) into the visual algorithm package SDK library, differences in development quality and delivery cycles due to different personnel responsible for developing these algorithms lead to compilation conflicts, runtime conflicts, and other issues, making it impossible to isolate modifications and maintain openness. In this embodiment, by supporting dynamic scalability, the main structure of the visual algorithm package SDK library can be maintained even when adding new visual image processing algorithms. By supporting dynamic scalability, compilation and runtime conflicts are eliminated. When a visual image processing algorithm is updated, the impact of the modification is limited to a local area. When problems occur, accurate location can be achieved, achieving the goal of isolating modifications and maintaining openness.
[0037] This application proposes an image processing method based on an SDK interface, enabling dynamic expansion and reduction of the algorithm integration library. This gives the visual algorithm package SDK library scalability and extensibility, offering significant advantages when encapsulating multiple algorithm integration libraries. Through explicit open interface standard constraints, integration is less prone to errors. The highly scalable and extensible design significantly reduces the development and maintenance burden on technical personnel. When integrating algorithm integration libraries, standardized and modular encapsulation is used, allowing for independent updates and on-demand loading of the libraries. The algorithm integration libraries adhere to the predefined interface specifications of the visual algorithm package SDK library.
[0038] In this embodiment, by supporting dynamic extensibility, the goal of "maintaining openness" is achieved, ensuring that the main structure of the visual algorithm package SDK library is not affected when adding new visual image processing algorithms. For example, regarding dynamic extensibility, when integrating new visual image processing algorithms, the main body of the visual algorithm package SDK library remains unchanged; that is, the existing visual image processing algorithms in the visual algorithm package SDK library do not change. It is only necessary to encapsulate the new visual image processing algorithm according to predefined specifications to form an algorithm integration library. The SDK framework layer can dynamically parse the algorithm processing capabilities of the newly added algorithm integration library, thereby completing the capability expansion. In this way, dynamic extensibility achieves the goal of maintaining openness.
[0039] See Figure 3A The diagram illustrates dynamic scalability. Algorithm integration library A is integrated on the SDK framework layer. When adding algorithm integration library B, as long as algorithm integration library B meets the interface specifications predefined by the main body of the SDK framework layer, the algorithm integration library .dll file (i.e., the .dll file of algorithm integration library B) can be dynamically loaded, thus satisfying dynamic scalability. Algorithm integration library A and algorithm integration library B are integrated on the SDK framework layer.
[0040] In this embodiment, by supporting dynamic scalability, problems such as "compilation conflicts and runtime conflicts" are solved, that is, there are no compilation conflicts and runtime conflicts. When a visual image processing algorithm is updated, the impact of the modification is limited to a local area. When a problem occurs, it can be accurately located to achieve the purpose of isolating the modification.
[0041] Regarding dynamic scalability, when algorithm libraries with compilation or runtime conflicts exist, the problematic library can be removed without affecting the operation of other functions. If problems arise after updating a particular algorithm library, the approximate location of the problem can be easily pinpointed using a process of elimination. Therefore, dynamic scalability effectively resolves the aforementioned compilation and runtime conflicts. By removing algorithm libraries involved in unnecessary functions, disk usage can be reduced, minimizing the runtime environment.
[0042] See Figure 3B The diagram illustrates dynamic scalability. Algorithm libraries A, B, and C are integrated at the SDK framework layer. Since the algorithm library files are in .dll (or .so) format, they can be deleted as needed without affecting other existing functionalities, thus satisfying dynamic scalability. For example, algorithm library C can be deleted from the SDK framework layer without affecting algorithm libraries A and B; the SDK framework layer still integrates algorithm libraries A and B.
[0043] In this embodiment, see Figure 4The diagram shows the overall architecture of the image processing method based on the SDK interface. This overall architecture is the overall architecture of the visual algorithm package SDK library (hereinafter referred to as the SDK library). The visual algorithm package SDK library can include an interface layer (i.e., the SDK interface layer, hereinafter referred to as the interface layer), a framework layer (i.e., the SDK framework layer, hereinafter referred to as the framework layer) and an algorithm integration layer.
[0044] The algorithm integration layer can include multiple algorithm integration libraries. Each library includes visual image processing algorithms and encapsulated public interfaces, which are encapsulated according to pre-configured interface specifications. Figure 4 In this paper, we will take the positioning algorithm integration library, the recognition algorithm integration library, and the measurement algorithm integration library as examples. Of course, there may be other algorithm integration libraries. There is no restriction on the type of algorithm integration library, such as at least one of the following: defect detection algorithm integration library, deep learning algorithm integration library, edge learning algorithm integration library, image preprocessing algorithm integration library, calibration algorithm integration library, and alignment algorithm integration library.
[0045] The interface layer can include multiple SDK interfaces (SDK interfaces can also be extended to other types of interfaces). Each SDK interface corresponds to an algorithm integration library in the algorithm integration layer; that is, one SDK interface corresponds to one algorithm integration library, but one algorithm integration library may correspond to multiple SDK interfaces. The functionality of an SDK interface is determined based on the visual processing capabilities supported by the corresponding algorithm integration library. For example, the interface layer may include a positioning SDK interface corresponding to a positioning algorithm integration library, a recognition SDK interface corresponding to a recognition algorithm integration library, and a measurement SDK interface corresponding to a measurement algorithm integration library. Of course, other SDK interfaces corresponding to other algorithm integration libraries may also exist, and the type of these SDK interfaces is not limited. For example, the interface layer includes one or more SDK interfaces corresponding to the defect detection algorithm integration library (if the defect detection algorithm integration library implements multiple functions, the defect detection algorithm integration library can correspond to multiple SDK interfaces, with each function corresponding to one SDK interface), one or more SDK interfaces corresponding to the deep learning algorithm integration library, one or more SDK interfaces corresponding to the edge learning algorithm integration library, one or more SDK interfaces corresponding to the image preprocessing algorithm integration library, one or more SDK interfaces corresponding to the calibration algorithm integration library, and one or more SDK interfaces corresponding to the alignment algorithm integration library.
[0046] At the framework layer, processes such as integration specifications, call processing, and basic implementation can be included. For integration specifications, the access specifications (i.e., interface specifications) of the algorithm integration layer can be defined. For example, if the algorithm integration library includes public interfaces encapsulated for visual image processing algorithms, the integration specifications are used to plan the interface specifications of these public interfaces, indicating how they are implemented. For call processing, the processing capabilities of the algorithm integration layer can be dynamically resolved, i.e., the visual processing capabilities of the algorithm integration library can be obtained. Call processing can act as a bridge between the interface layer and the algorithm integration layer, maintaining the correspondence between the interface identifier of the SDK interface and the object identifier of the integration library instance object, thereby finding the correspondence between the SDK interface and the algorithm integration library. Call processing can manage the integration library instance objects of the algorithm integration library. For basic implementation, common operation implementations can be provided, and memory and execution resource allocation can be implemented. The basic implementation works in conjunction with the visual algorithm package SDK library to complete the processing process, without imposing any restrictions on this process.
[0047] The framework layer can determine the target algorithm integration library corresponding to the interface identifier of the target SDK interface, and the framework layer calls the visual image processing algorithm in the target algorithm integration library to process the image to be processed.
[0048] In the above application scenarios, this application proposes a method for managing an algorithm integration library, see [link to relevant documentation]. Figure 5 The diagram shown illustrates a flowchart of a method for managing an algorithm integration library. This method may include: Step 501: Create an algorithm integration library. The algorithm integration library includes visual image processing algorithms and encapsulated public interfaces. The public interfaces meet the configured interface specifications, that is, they are encapsulated according to the preset interface specifications.
[0049] For example, after obtaining a visual image processing algorithm, a public interface can be encapsulated to obtain an algorithm integration library. See [link to documentation]. Figure 4 As shown, the framework layer defines the access specifications (i.e., interface specifications) of the algorithm integration layer, which can encapsulate public interfaces that meet these specifications for visual image processing algorithms.
[0050] In this embodiment, this interface specification is used to instruct the public interface to implement the following functions: querying the visual processing capabilities of the algorithm integration library, creating an integration library instance object, and destroying the integration library instance object. Based on this, the public interface can include a first type of public interface, a second type of public interface, and a third type of public interface. The first type of public interface is used to query the visual processing capabilities supported by the algorithm integration library, the second type of public interface is used to create an integration library instance object, and the third type of public interface is used to destroy the integration library instance object. In summary, the first type of public interface, the second type of public interface, and the third type of public interface can be used to encapsulate visual image processing algorithms.
[0051] For example, the algorithm integration library needs to support a first type of public interface, named GetSupportToolAbility (configurable according to actual needs). This first type of public interface is used to query the visual processing capabilities supported by the algorithm integration library. The framework layer queries the supported visual processing capabilities by calling this first type of public interface; that is, the first type of public interface returns the supported visual processing capabilities of the algorithm integration library. For example, the framework layer queries a list of supported processing capabilities by calling the first type of public interface, and the first type of public interface returns a list of supported processing capabilities, which may include at least one supported visual processing capability.
[0052] For example, the algorithm integration library needs to support a second type of public interface. The interface name for this second type of public interface is CreateAlgorithmTool (configurable according to actual needs). This second type of public interface is used to create an instance object of the algorithm integration library. The framework layer creates this instance object by calling this second type of public interface and returns it for the SDK interface layer to call. This establishes a call channel between the SDK interface layer and the algorithm integration library layer, enabling the algorithm integration library to be invoked.
[0053] For example, the algorithm integration library needs to support a third type of public interface. The interface name of the third type of public interface is DestroyAlgorithmTool (which can be configured according to actual needs). The third type of public interface is used to destroy the integration library instance object of the algorithm integration library. The framework layer destroys the integration library instance object of the algorithm integration library by calling the third type of public interface, that is, destroys the integration library instance object created by the second type of public interface.
[0054] In one possible implementation, a visual image processing algorithm X1 can be obtained, and this algorithm is used to implement a positioning function. The visual image processing algorithm X1 is used to locate the position of a workpiece in an image, which may be a circular or rectangular position, etc. Based on this, a common interface is encapsulated for the visual image processing algorithm X1 to obtain an algorithm integration library. This algorithm integration library is called the positioning algorithm integration library. The processing capability list of the positioning algorithm integration library includes capabilities related to the positioning function, such as circle search capability and line search capability. Based on these capabilities, the positioning algorithm integration library can locate the position of the workpiece in the image.
[0055] A visual image processing algorithm X2 can be obtained, and this algorithm is used to implement the recognition function. The visual image processing algorithm X2 is used to recognize the content in an image, such as character content (e.g., ABC characters) and code content (e.g., express delivery codes). Based on this, a public interface is encapsulated for the visual image processing algorithm X2 to obtain an algorithm integration library, which is called the recognition algorithm integration library. The processing capability list of the recognition algorithm integration library includes capabilities related to the recognition function, such as character recognition capabilities and code reading capabilities. Based on these capabilities, the recognition algorithm integration library can recognize the content in an image.
[0056] A visual image processing algorithm X3 can be obtained, and this algorithm is used to implement measurement functions. X3 measures parameters in an image, such as distance parameters (e.g., the distance between two objects), similarity parameters (e.g., the similarity between two objects), and histogram parameters. Based on this, a public interface is encapsulated for the visual image processing algorithm X3 to obtain an algorithm integration library, which is called the measurement algorithm integration library. The library's processing capabilities list includes capabilities related to measurement functions, such as parameter measurement capabilities. Based on these capabilities, the measurement algorithm integration library can measure parameters in an image.
[0057] In summary, the creation of integrated libraries for positioning, identification, and measurement algorithms is crucial. Figure 4 In this layer, the algorithm integration layer includes a positioning algorithm integration library, a recognition algorithm integration library, and a measurement algorithm integration library.
[0058] Step 502: Create an SDK interface object instance for the SDK interface corresponding to the algorithm integration library. For example, the function of this SDK interface corresponds to the visual processing capabilities supported by the algorithm integration library. Since the visual processing capabilities supported by the algorithm integration library are determined based on the public interfaces of the algorithm integration library (such as the first type of public interface), the function of this SDK interface is also determined based on the public interfaces of the algorithm integration library (such as the first type of public interface).
[0059] After creating an instance of the SDK interface object, it's equivalent to binding this SDK interface to the algorithm integration library. The SDK interface object instance can be a handle value; this handle value is the SDK interface object instance of the SDK interface, and this handle value is associated with the algorithm integration library. When calling the SDK interface, passing this handle value allows for dynamic calls to the algorithm integration library. Clearly, the SDK interface object instance can be understood as a bridge between the SDK interface and the algorithm integration library.
[0060] For example, see Figure 4 As shown, the framework layer's call processing supports "dynamically resolving the processing capabilities of the algorithm integration layer." Based on this, for an algorithm integration library, its processing capability list can be queried through the library's first type of public interface. This list can include the visual processing capabilities supported by the library. For example, the first type of public interface (such as GetSupportToolAbility) is used to query the library's processing capability list. Therefore, the framework layer can query the library's processing capability list based on GetSupportToolAbility and then parse the supported visual processing capabilities from this list.
[0061] For example, an SDK interface object instance corresponding to the SDK interface of the algorithm integration library can be created, and the function of the SDK interface can be determined based on the visual processing capabilities supported by the algorithm integration library, such that the function of the SDK interface corresponds to the visual processing capabilities supported by the algorithm integration library.
[0062] For example, the processing capability list of the positioning algorithm integration library includes capabilities related to positioning functions. That is, the visual processing capabilities supported by the positioning algorithm integration library are positioning capabilities, such as circle lookup and line lookup. Therefore, when creating an SDK interface object instance corresponding to the positioning algorithm integration library's SDK interface, the function of this SDK interface can be positioning, and this SDK interface is called the positioning SDK interface. Furthermore, the functionality of the positioning SDK interface can be provided externally. Thus, for images requiring positioning functionality, the positioning algorithm integration library will be called through the positioning SDK interface (such as an SDK interface object instance of the positioning SDK interface) to achieve the "positioning" processing of the image.
[0063] For example, the processing capability list of the recognition algorithm integration library includes capabilities related to recognition functions; that is, the visual processing capability supported by the recognition algorithm integration library is recognition capability. When creating an SDK interface object instance corresponding to the recognition algorithm integration library's SDK interface, the function of this SDK interface can be recognition functionality, and this SDK interface is called the recognition SDK interface. Furthermore, the functionality of the recognition SDK interface can be exposed externally. In this way, for images to be processed that require recognition functionality, the recognition algorithm integration library will be called through the recognition SDK interface to achieve the "recognition" processing of the images.
[0064] For example, the processing capability list of the measurement algorithm integration library includes capabilities related to measurement functions; that is, the visual processing capabilities supported by the measurement algorithm integration library are measurement capabilities. When creating an SDK interface object instance corresponding to the SDK interface of the measurement algorithm integration library, the function of this SDK interface can be measurement functionality, and this SDK interface is called the measurement SDK interface. Furthermore, the functionality of the measurement SDK interface can be exposed externally. In this way, for images to be processed that require measurement functionality, the measurement algorithm integration library will be called through the measurement SDK interface to achieve the "measurement" processing of the images.
[0065] In summary, if the algorithm integration library supports localization visual processing, then the corresponding SDK interface functions as a localization function, and the algorithm integration library is called a localization algorithm integration library, and the SDK interface is called a localization SDK interface. If the algorithm integration library supports recognition visual processing, then the corresponding SDK interface functions as a recognition function, and the algorithm integration library is called a recognition algorithm integration library, and the SDK interface is called a recognition SDK interface. If the algorithm integration library supports measurement visual processing, then the corresponding SDK interface functions as a measurement function, and the algorithm integration library is called a measurement algorithm integration library, and the SDK interface is called a measurement SDK interface. These are just a few examples, and no restrictions are placed on the algorithm integration library and SDK interface.
[0066] In summary, by creating SDK interface object instances for the positioning SDK interface, the identification SDK interface, and the measurement SDK interface, then, in Figure 4 In this process, the interface layer may include a positioning SDK interface, an identification SDK interface, and a measurement SDK interface.
[0067] For example, for the framework layer, after querying the visual processing capabilities supported by the algorithm integration library through the first type of public interface, an SDK interface object instance can be created (this can be any SDK interface object instance, as long as it can be passed to the SDK interface), and the first mapping relationship between the SDK interface object instance and the algorithm integration library can be recorded, thereby binding the SDK interface object instance to the algorithm integration library. Furthermore, the framework layer can provide the SDK interface object instance to the interface layer, allowing the interface layer to select an SDK interface from a predefined pool of SDK interfaces and create an SDK interface object instance for that SDK interface; that is, the SDK interface object instance is paired with that SDK interface.
[0068] Since the SDK interface object instance is bound to the algorithm integration library, and the SDK interface object instance is paired with the SDK interface, the SDK interface and the algorithm integration library can be bound through the SDK interface object instance, and the function of this SDK interface corresponds to the visual processing capabilities supported by the algorithm integration library.
[0069] Step 503: Create an integration library instance object corresponding to the algorithm integration library. For an algorithm integration library, you can create one integration library instance object or multiple integration library instance objects.
[0070] For example, when creating an SDK interface object instance at the interface layer (i.e., creating an SDK interface object instance at the interface layer), the SDK interface object instance can be input to the framework layer. The framework layer obtains the algorithm integration library corresponding to the SDK interface object instance by reading the first mapping relationship (the first mapping relationship between the SDK interface object instance and the algorithm integration library). Based on this, an integration library instance object of the algorithm integration library is created through the second type of public interface of the algorithm integration library, and the second mapping relationship between the interface identifier of the SDK interface and the object identifier of the integration library instance object is recorded.
[0071] For example, see Figure 4 As shown, the framework layer's call processing supports the function of "managing algorithm integration library instances." Based on this, for an algorithm integration library, an integration library instance object can be created through the second type of public interface of the algorithm integration library. For example, the second type of public interface of the algorithm integration library (such as CreateAlgorithmTool) is used to create an integration library instance object of the algorithm integration library, and the framework layer creates the integration library instance object of the algorithm integration library based on the CreateAlgorithmTool of the algorithm integration library.
[0072] For example, create an instance object s1 corresponding to the positioning algorithm integration library, an instance object s2 corresponding to the recognition algorithm integration library, and an instance object s3 corresponding to the measurement algorithm integration library.
[0073] For example, for an algorithm integration library, the object identifier of the integration library instance object corresponds to the interface identifier of the SDK interface corresponding to the algorithm integration library. See also Figure 4 As shown, the framework layer's call processing supports the function of "acting as a call bridge between the interface layer and the algorithm integration layer." In this way, the correspondence between the interface identifier of the SDK interface and the object identifier of the integration library instance object can be maintained, that is, the second mapping relationship between the interface identifier of the SDK interface and the object identifier of the integration library instance object.
[0074] For example, if a location algorithm integration library corresponds to a location SDK interface, and the location algorithm integration library corresponds to an integration library instance object s1, then we can maintain the correspondence between the interface identifier of the location SDK interface and the object identifier of the integration library instance object s1. The interface identifier of the location SDK interface is a unique identifier for the location SDK interface, and this identifier uniquely corresponds to the location SDK interface. Similarly, the object identifier of the integration library instance object s1 is a unique identifier for the integration library instance object s1, and this identifier uniquely corresponds to the integration library instance object s1. Furthermore, since the integration library instance object s1 corresponds to the location algorithm integration library, this object identifier can be used to find the location algorithm integration library, thus allowing us to associate the location SDK interface with the location algorithm integration library.
[0075] In one possible implementation, after creating the instance object of the algorithm integration library, the instance object can also be destroyed. See also Figure 4 As shown, the framework layer's call processing supports the function of "managing algorithm integration library instances." Based on this, after creating an integration library instance object through the second type of public interface of the algorithm integration library, it can also destroy the integration library instance object through the third type of public interface of the algorithm integration library. For example, the third type of public interface of the algorithm integration library (such as DestroyAlgorithmTool) is used to destroy the integration library instance object. Therefore, the framework layer can destroy the integration library instance object of the algorithm integration library based on DestroyAlgorithmTool to stop calling the algorithm integration library to process the image to be processed through the destroyed integration library instance object. For example, after creating the integration library instance object s1 corresponding to the positioning algorithm integration library, it can also destroy the integration library instance object s1, and stop calling the positioning algorithm integration library to process the image to be processed through the integration library instance object s1.
[0076] As can be seen from the above, a unified calling interface is provided to the interface layer, shielding the calling details and standardized calling methods of the algorithm integration library. The framework layer, acting as a bridge between the interface layer and the algorithm integration layer, achieves decoupling between the two. If the algorithm integration library needs to be updated, the impact only affects one specific algorithm integration library within the algorithm integration layer; existing SDK interfaces in the interface layer do not require modification.
[0077] In one possible implementation, when adding a new first algorithm integration library, the first algorithm integration library includes visual image processing algorithms and encapsulated public interfaces. The public interfaces include a first type of public interface, a second type of public interface, and a third type of public interface. The first type of public interface is used to query the visual processing capabilities supported by the first algorithm integration library, the second type of public interface is used to create an integration library instance object of the first algorithm integration library, and the third type of public interface is used to destroy the integration library instance object of the first algorithm integration library.
[0078] The visual processing capabilities supported by the first algorithm integration library can be queried through the first type of public interface. An instance object of the first algorithm integration library can be created through the second type of public interface. The process of adding the first algorithm integration library is detailed in steps 501-503 and will not be repeated here. As can be seen from the process of adding the first algorithm integration library, dynamic extensibility is supported. That is, when the visual algorithm package SDK library integrates the first algorithm integration library, the existing algorithm integration library of the visual algorithm package SDK library remains unchanged; the visual image processing algorithms are simply encapsulated into public interfaces according to predefined specifications to form the first algorithm integration library.
[0079] In one possible implementation, when deleting an existing second algorithm integration library, the integration library instance object of the second algorithm integration library can be destroyed through the third type of public interface of the second algorithm integration library. This includes destroying all integration library instance objects of the second algorithm integration library and deleting the correspondence between the object identifier of the integration library instance object and the interface identifier of the SDK interface, i.e., deleting all correspondences between the object identifiers of the integration library instance objects. After the integration library instance objects are destroyed, the second algorithm integration library can also be destroyed, i.e., removed from the algorithm integration layer (deleting the second algorithm integration library). Furthermore, the interface identifier corresponding to the object identifier of the integration library instance object of the second algorithm integration library can be determined, and the SDK interface object instance of the second SDK interface corresponding to that interface identifier can be destroyed. For example, the SDK interface object instance of the second SDK interface corresponding to that interface identifier can be deleted from the interface layer.
[0080] For example, when deleting the location algorithm integration library, the integration library instance object s1 can be destroyed through the third type of public interface of the location algorithm integration library, and the correspondence between the object identifier of the integration library instance object s1 and the interface identifier of the location SDK interface can be deleted. After the integration library instance object s1 is destroyed, the location algorithm integration library can also be deleted from the algorithm integration layer. In addition, the interface identifier corresponding to the object identifier of the integration library instance object s1, i.e., the interface identifier of the location SDK interface, can be determined, and the SDK interface object instance of the location SDK interface can be deleted from the interface layer.
[0081] In the above application scenarios, this application proposes an image processing method based on an SDK interface, see [link to relevant documentation]. Figure 6 The diagram shown is a flowchart of the method, which may include: Step 601: Obtain the interface identifier of the target SDK interface. This interface identifier can be a unique identifier for the target SDK interface. When performing a specified type of processing on the image to be processed, the function of the target SDK interface corresponds to the function of the specified type of processing, such as the function of the target SDK interface being the same as the function of the specified type of processing.
[0082] For example, each SDK interface provides its own functionality. If the functionality of each SDK interface is known—for instance, the positioning SDK interface provides positioning, the recognition SDK interface provides recognition, and the measurement SDK interface provides measurement—then when image processing needs to be performed (i.e., the specified processing type is positioning, and both the target SDK interface and the specified processing type are positioning functions), image processing must be implemented through the positioning SDK interface. This involves calling the algorithm integration library through the positioning SDK interface. Therefore, by using the positioning SDK interface as the target SDK interface, its interface identifier can be obtained. Similarly, when image processing needs to be performed for recognition, the recognition SDK interface can be used as the target SDK interface to obtain its interface identifier.
[0083] Step 602: Determine the object identifier corresponding to the interface identifier of the target SDK interface.
[0084] Since the mapping between the interface identifiers of the SDK interfaces and the object identifiers of the integration library instance objects has already been maintained (i.e., the second mapping relationship mentioned above), the object identifier of the integration library instance object can be obtained by querying this mapping relationship through the interface identifier of the target SDK interface. For example, if the interface identifier of the target SDK interface is the interface identifier of the positioning SDK interface, then the object identifier of the integration library instance object s1 can be retrieved.
[0085] Step 603: Determine the target algorithm integration library corresponding to the object identifier.
[0086] For example, if the object identifier is the object identifier of the integration library instance object s1, since the integration library instance object s1 is created for the positioning algorithm integration library, the target algorithm integration library is the positioning algorithm integration library.
[0087] Step 604: Call the visual image processing algorithm in the target algorithm integration library and process the image to be processed by the visual image processing algorithm. No restrictions are placed on this processing procedure.
[0088] For example, if the target algorithm integration library is a positioning algorithm integration library, then the visual image processing algorithm X1 in the positioning algorithm integration library is used to perform positioning processing on the image to be processed, such as locating the position of the workpiece in the image to be processed by the visual image processing algorithm X1. There are no restrictions on this positioning processing process.
[0089] For example, if the target algorithm integration library is a recognition algorithm integration library, then the visual image processing algorithm X2 in the recognition algorithm integration library is used to recognize and process the image to be processed, such as recognizing the content of the image to be processed, such as character content, code content, etc., through the visual image processing algorithm X2.
[0090] For example, if the target algorithm integration library is a measurement algorithm integration library, then the visual image processing algorithm X3 in the measurement algorithm integration library is used to measure and process the image to be processed, such as measuring parameters in the image to be processed, such as distance parameters, similarity parameters, histogram parameters, etc., through the visual image processing algorithm X3.
[0091] In one possible implementation, if no operation parameters for the image to be processed exist (e.g., when the interface identifier of the target SDK interface is obtained, but no operation parameters are obtained from the outside), a visual image processing algorithm within the target algorithm integration library can be invoked. This algorithm processes the image using default parameters. For example, default parameters can be provided to the visual image processing algorithm. For a localization algorithm integration library, these default parameters are related to localization processing; for a recognition algorithm integration library, they are related to recognition processing; and for a measurement algorithm integration library, they are related to measurement processing. The content of these default parameters is not limited. Based on this, the visual image processing algorithm can run with the default parameters to process the image.
[0092] In one possible implementation, if operation parameters for the image to be processed exist (e.g., operation parameters obtained externally when the interface identifier of the target SDK interface is obtained), a visual image processing algorithm within the target algorithm integration library can be invoked. The visual image processing algorithm then runs the operation parameters to process the image. For example, operation parameters (i.e., operation parameters set according to actual needs) can be obtained and provided to the visual image processing algorithm. For a positioning algorithm integration library, these operation parameters are related to positioning processing; for a recognition algorithm integration library, they are related to recognition processing; and for a measurement algorithm integration library, they are related to measurement processing. The content of these operation parameters is not limited. Based on this, the visual image processing algorithm can run the operation parameters to process the image.
[0093] In one possible implementation, see Figure 7 The diagram illustrates the public interfaces of the algorithm integration library. The algorithm integration library can be a .dll or .so file. It supports three types of public interfaces: The first type, `GetSupportToolAbility`, returns the supported visual processing capabilities, indicating which visual processing capability the library supports (e.g., circle search, line search). The second type, `CreateAlgorithmTool`, creates an instance of the algorithm integration library based on the processing type (e.g., localization, recognition, measurement) and returns the instance object interface. The third type, `DestroyAlgorithmTool`, destroys the instance of the algorithm integration library based on the processing type.
[0094] For example, the algorithm integration library provides a unified interface for external operations, namely the algorithm integration library instance interface (denoted as IAlgorithmTool). This means that the algorithm integration library can be called through the integration library instance object. Specifically, the algorithm integration library is located through the object identifier of the integration library instance object, and then processed by the algorithm integration library to process the image to be processed. For the algorithm integration library instance interface, when calling a specific algorithm integration library, only the input data structure, output result structure, and running parameters are needed to complete a complete algorithm processing call. Therefore, the algorithm integration library instance interface (IAlgorithmTool) can support the following three interfaces: setting parameters (SetRunParam), getting parameters (GetRunParam), and algorithm processing (Process). Of course, other algorithm integration library instance interfaces can be extended as needed. For example, setting parameters means obtaining the operation parameters from the outside and providing them to the visual image processing algorithm within the algorithm integration library. Getting parameters means providing the default parameters to the visual image processing algorithm within the algorithm integration library if no operation parameters are obtained from the outside. Algorithm processing means that the visual image processing algorithm within the algorithm integration library runs the default parameters or operation parameters to process the image to be processed.
[0095] In one possible implementation, see Figure 8 The diagram shown is a schematic of the call process.
[0096] For the interface layer, the process may involve initialization, creating SDK interface object instances, calling SDK interface object instances, destroying SDK interface object instances, and deinitialization. Here, the SDK interface object instance can be an SDK interface object instance of an SDK interface.
[0097] For the algorithm integration layer, a set of algorithm integration library files can be provided. This set can include location algorithm integration library files (.dll or .so files, i.e., location algorithm integration library), recognition algorithm integration library files (.dll or .so files, i.e., recognition algorithm integration library), and measurement algorithm integration library files (.dll or .so files, i.e., measurement algorithm integration library). Each algorithm integration library can self-describe its supported algorithm processing capabilities, implemented through the public interface GetSupportToolAbility. The interface layer objects are completely decoupled from the algorithm integration layer and are unaware of each other; the framework layer acts as a calling bridge. Only algorithm integration libraries that meet the interface specifications defined by the framework layer (the interface specifications defining the public interface) can be recognized by the framework layer.
[0098] For the framework layer, the visual processing capabilities supported by the algorithm integration layer can be dynamically resolved, such as the visual processing capabilities supported by the positioning algorithm integration library, the visual processing capabilities supported by the recognition algorithm integration library, and the visual processing capabilities supported by the measurement algorithm integration library, which is achieved by calling the public interface GetSupportToolAbility.
[0099] Establish mappings based on processing type, such as establishing a mapping relationship between SDK interface object instances and algorithm integration libraries, such as establishing a mapping relationship between SDK interface object instances of the positioning SDK interface and positioning algorithm integration libraries, establishing a mapping relationship between SDK interface object instances of the recognition SDK interface and recognition algorithm integration libraries, and establishing a mapping relationship between SDK interface object instances of the measurement SDK interface and measurement algorithm integration libraries.
[0100] When creating an SDK interface object at the interface layer, a corresponding algorithm integration library instance object can be created. For example, the framework layer determines the algorithm integration library corresponding to the SDK interface object instance by reading the mapping relationship, and creates the integration library instance object by calling the public interface GetSupportToolAbility of that algorithm integration library. After creating the integration library instance object, the framework layer can maintain the correspondence between the object identifier of the integration library instance object and the interface identifier corresponding to the SDK interface object instance (i.e., the interface identifier of the SDK interface corresponding to the SDK interface object instance). After creating the integration library instance object, the framework layer can also return the IAlgorithmTool parameter to the SDK interface object instance. This IAlgorithmTool parameter can include default parameters. Users can view the default parameters through the interface layer. If they expect to process the image using the default parameters, no operation parameters are provided; if they expect to process the image without using the default parameters, operation parameters can be provided.
[0101] When the SDK interface object instance is called at the interface layer, the framework layer can call the integration library instance object of the algorithm integration library. Specifically, it determines the object identifier of the integration library instance object corresponding to the interface identifier of the SDK interface, identifies the corresponding algorithm integration library, and then calls that algorithm integration library to process the image to be processed. For example, when calling the algorithm integration library, this can be achieved by calling the IAlgorithmTool interface, which provides operation parameters or default parameters to the visual image processing algorithm within the algorithm integration library, runs the algorithm with the default or operation parameters, and processes the image to be processed.
[0102] When the SDK interface object instance is destroyed at the interface layer, the framework layer can destroy the integration library instance object of the algorithm integration library. For example, the framework layer can destroy the integration library instance object of the algorithm integration library by calling the public interface DestroyAlgorithmTool.
[0103] During deinitialization at the interface layer, the framework layer can release resources and unload the algorithm integration library.
[0104] In summary, regarding how the framework layer parses the functions supported by the algorithm integration layer and handles interface layer calls, the framework layer relies on the return values of the GetSupportToolAbility interface in each algorithm integration library. Based on these return values, it determines which visual image processing algorithms are integrated. The framework layer does not care about the naming of the algorithm integration libraries, as long as they meet the predefined interface specifications. Each algorithm integration library is independent and uncoupled. Therefore, multiple algorithm integration libraries can be merged and encapsulated to form a single integration library, or a single integration library can be split into multiple libraries, or unused integration libraries can be deleted as needed.
[0105] As can be seen from the above technical solutions, the embodiments of this application achieve the ability to dynamically expand and shrink the algorithm integration library, enabling the visual algorithm package SDK library to have scalability and extensibility, significantly reducing the burden and investment in product development and maintenance. When integrating a large number of algorithm integration libraries, it can significantly reduce compilation conflicts and runtime conflicts caused by developers' skills, development quality, and delivery cycles, achieving decoupling between the SDK interface and visual image processing algorithms. Updates to the algorithm integration library will not affect the SDK interface and the main framework, thus limiting the impact to a local area and isolating modifications to the algorithm integration library. Over time, as functions iterate, it can better adapt to changes and extend the lifecycle of the SDK library.
[0106] Based on the same concept as the above method, this application proposes an image processing device based on an SDK interface, see [link to application]. Figure 9A The diagram shown is a structural schematic of the device, which includes: The determination module 911 is used to determine the target algorithm integration library corresponding to the interface identifier of the target SDK interface; the target algorithm integration library includes visual image processing algorithms and a public interface encapsulated according to a preset interface specification, the public interface is used to realize the mapping between the target SDK interface and the target algorithm integration library; the function of the target SDK interface is determined based on the visual processing capabilities supported by the target algorithm integration library. The processing module 912 is used to call the visual image processing algorithm in the target algorithm integration library and process the image to be processed by the visual image processing algorithm.
[0107] For example, the public interface includes a first type of public interface, and the first type of public interface is used to query the visual processing capabilities supported by the target algorithm integration library. The processing module 912 is also used to query the visual processing capabilities supported by the target algorithm integration library through the first type of public interface.
[0108] For example, the public interface includes a second type of public interface, and the second type of public interface is used to create an integration library instance object of the target algorithm integration library. The processing module 912 is also used to create an integration library instance object of the target algorithm integration library through the second type of public interface; wherein, the object identifier of the integration library instance object corresponds to the interface identifier of the target SDK interface, and the object identifier of the integration library instance object corresponds to the target algorithm integration library.
[0109] For example, the processing module 912 is further configured to, after querying the visual processing capabilities supported by the target algorithm integration library through the first type of public interface, record a first mapping relationship between the SDK interface object instance and the target algorithm integration library; the processing module 912 is further configured to, when creating the SDK interface object instance for the target SDK interface, obtain the target algorithm integration library corresponding to the SDK interface object instance by reading the first mapping relationship; create an integration library instance object of the target algorithm integration library through the second type of public interface of the target algorithm integration library, and record a second mapping relationship between the interface identifier of the target SDK interface and the object identifier of the integration library instance object.
[0110] For example, when determining the target algorithm integration library corresponding to the interface identifier of the target SDK interface, the determining module 911 is specifically used to: query the second mapping relationship based on the interface identifier of the target SDK interface to obtain the object identifier of the integration library instance object corresponding to the interface identifier of the target SDK interface; and determine the target algorithm integration library based on the object identifier of the integration library instance object.
[0111] For example, the public interface includes a third type of public interface, and the third type of public interface is used to destroy the integration library instance object of the target algorithm integration library. The processing module 912 is also used to destroy the integration library instance object of the target algorithm integration library through the third type of public interface, so as to stop the processing of the image to be processed by calling the target algorithm integration library through the destroyed integration library instance object.
[0112] For example, the processing module 912 is further configured to query the visual processing capabilities supported by the first algorithm integration library through the first type of public interface of the first algorithm integration library to be added, record the mapping relationship between the first SDK interface object instance and the first algorithm integration library, wherein the first SDK interface object instance corresponds to the visual processing capability; create the first SDK interface object instance for the first SDK interface of the SDK interface layer, obtain the first algorithm integration library corresponding to the first SDK interface object instance by reading the mapping relationship; create an integration library instance object of the first algorithm integration library through the second type of public interface of the first algorithm integration library, record the mapping relationship between the interface identifier of the first SDK interface and the object identifier of the integration library instance object, wherein the object identifier of the integration library instance object corresponds to the first algorithm integration library.
[0113] The processing module 912 is further configured to, when destroying the second SDK interface object instance for the second SDK interface of the SDK interface layer, obtain the first algorithm integration library corresponding to the second SDK interface object instance by reading the mapping relationship; destroy the integration library instance object of the second algorithm integration library through the third type of public interface of the second algorithm integration library; and destroy the second algorithm integration library after the integration library instance object is destroyed.
[0114] Based on the same concept as the above method, this application proposes an electronic device, see [link to previous application]. Figure 9B As shown, it includes: a processor 921 and a machine-readable storage medium 922, the machine-readable storage medium 922 storing machine-executable instructions that can be executed by the processor 921; the processor 921 is used to execute the machine-executable instructions to implement the image processing method based on the SDK interface disclosed in the above example of this application.
[0115] Based on the same concept as the above method, this application also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the image processing method based on the SDK interface disclosed in the above examples of this application.
[0116] The aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.
[0117] Based on the same concept as the methods described above, this application also provides a computer program product, which may include a computer program. When executed by a processor, the computer program implements the image processing method based on the SDK interface disclosed in the examples above.
[0118] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0119] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An image processing method based on an SDK interface, characterized in that, The method includes: Identify the target algorithm integration library corresponding to the interface identifier of the target SDK interface; wherein, the target algorithm integration library includes visual image processing algorithms and a public interface encapsulated according to a preset interface specification, the public interface being used to implement the mapping between the target SDK interface and the target algorithm integration library; wherein, the function of the target SDK interface is determined based on the visual processing capabilities supported by the target algorithm integration library; The visual image processing algorithm in the target algorithm integration library is invoked to process the image to be processed.
2. The method according to claim 1, characterized in that, The public interface includes a first type of public interface, and the first type of public interface is used to query the visual processing capabilities supported by the target algorithm integration library. The method further includes: The visual processing capabilities supported by the target algorithm integration library can be queried through the first type of public interface.
3. The method according to claim 1, characterized in that, The public interface includes a second type of public interface, and the second type of public interface is used to create an integration library instance object of the target algorithm integration library. The method further includes: An integration library instance object of the target algorithm integration library is created through the second type of public interface; wherein, the object identifier of the integration library instance object corresponds to the interface identifier of the target SDK interface, and the object identifier of the integration library instance object corresponds to the target algorithm integration library.
4. The method according to claim 3, characterized in that, The method further includes: After querying the visual processing capabilities supported by the target algorithm integration library through the first type of public interface, the first mapping relationship between the SDK interface object instance and the target algorithm integration library is recorded; When creating the SDK interface object instance for the target SDK interface, the target algorithm integration library corresponding to the SDK interface object instance is obtained by reading the first mapping relationship; the integration library instance object of the target algorithm integration library is created through the second type of public interface of the target algorithm integration library, and the second mapping relationship between the interface identifier of the target SDK interface and the object identifier of the integration library instance object is recorded.
5. The method according to claim 4, characterized in that, The determination of the target algorithm integration library corresponding to the interface identifier of the target SDK interface includes: Based on the interface identifier of the target SDK interface, query the second mapping relationship to obtain the object identifier of the integration library instance object corresponding to the interface identifier of the target SDK interface; The target algorithm integration library is determined based on the object identifier of the integration library instance object.
6. The method according to claim 1, characterized in that, The public interface includes a third type of public interface, and the third type of public interface is used to destroy the integration library instance object of the target algorithm integration library. The method further includes: destroying the integration library instance object of the target algorithm integration library through the third type of public interface, so as to stop calling the target algorithm integration library to process the image to be processed through the destroyed integration library instance object.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: The first type of public interface of the first algorithm integration library to be added is used to query the visual processing capabilities supported by the first algorithm integration library, and the mapping relationship between the first SDK interface object instance and the first algorithm integration library is recorded. The first SDK interface object instance corresponds to the visual processing capability. Create a first SDK interface object instance for the first SDK interface of the SDK interface layer, and obtain the first algorithm integration library corresponding to the first SDK interface object instance by reading the mapping relationship; An integration library instance object of the first algorithm integration library is created through the second type of public interface of the first algorithm integration library, and the mapping relationship between the interface identifier of the first SDK interface and the object identifier of the integration library instance object is recorded, and the object identifier of the integration library instance object corresponds to the first algorithm integration library.
8. The method according to any one of claims 1-6, characterized in that, The method further includes: When destroying the second SDK interface object instance for the second SDK interface of the SDK interface layer, the first algorithm integration library corresponding to the second SDK interface object instance is obtained by reading the mapping relationship; The second algorithm integration library instance object is destroyed through the third type of public interface of the second algorithm integration library, and the second algorithm integration library is destroyed after the integration library instance object is destroyed.
9. A visual algorithm package SDK library, characterized in that, The visual algorithm package SDK library includes: an SDK interface layer, an SDK framework layer, and an algorithm integration layer; wherein: The algorithm integration layer includes multiple algorithm integration libraries, which include visual image processing algorithms and public interfaces encapsulated according to preset interface specifications; wherein, the public interfaces are used to implement the mapping between SDK interfaces and the algorithm integration libraries; The SDK interface layer includes multiple SDK interfaces, and each SDK interface corresponds to an algorithm integration library in the algorithm integration layer; wherein, the function of each SDK interface is determined based on the visual processing capabilities supported by the corresponding algorithm integration library. The SDK framework layer determines the target algorithm integration library corresponding to the interface identifier of the target SDK interface; and calls the visual image processing algorithm in the target algorithm integration library to process the image to be processed.
10. The visual algorithm package SDK library according to claim 9, characterized in that, The public interface includes a first type of public interface, and the first type of public interface is used to query the visual processing capabilities supported by the target algorithm integration library. The SDK framework layer queries the visual processing capabilities supported by the target algorithm integration library through the first type of public interface. Alternatively, the public interface includes a second type of public interface, and the second type of public interface is used to create an integration library instance object of the target algorithm integration library. The SDK framework layer creates the integration library instance object of the target algorithm integration library through the second type of public interface. The object identifier of the integration library instance object corresponds to the interface identifier of the target SDK interface, and the object identifier of the integration library instance object corresponds to the target algorithm integration library. Alternatively, after querying the visual processing capabilities supported by the target algorithm integration library through the first type of public interface, the SDK framework layer records the first mapping relationship between the SDK interface object instance and the target algorithm integration library; When the SDK interface layer creates the SDK interface object instance for the target SDK interface, the SDK framework layer obtains the target algorithm integration library corresponding to the SDK interface object instance by reading the first mapping relationship; the SDK framework layer creates an integration library instance object of the target algorithm integration library through the second type of public interface of the target algorithm integration library, and records the second mapping relationship between the interface identifier of the target SDK interface and the object identifier of the integration library instance object; Alternatively, the public interface may include a third type of public interface, which is used to destroy the integration library instance object of the target algorithm integration library. The SDK framework layer destroys the integration library instance object of the target algorithm integration library through the third type of public interface to stop calling the target algorithm integration library to process the image to be processed through the destroyed integration library instance object.
11. An image processing device based on an SDK interface, characterized in that, The device includes: The determination module is used to determine the target algorithm integration library corresponding to the interface identifier of the target SDK interface; the target algorithm integration library includes visual image processing algorithms and a public interface encapsulated according to a preset interface specification, the public interface is used to realize the mapping between the target SDK interface and the target algorithm integration library; the function of the target SDK interface is determined based on the visual processing capabilities supported by the target algorithm integration library. The processing module is used to call the visual image processing algorithm in the target algorithm integration library and process the image to be processed through the visual image processing algorithm.
12. The apparatus according to claim 11, characterized in that, The public interface includes a first type of public interface, and the first type of public interface is used to query the visual processing capabilities supported by the target algorithm integration library. The processing module is also used to query the visual processing capabilities supported by the target algorithm integration library through the first type of public interface. Alternatively, the public interface includes a second type of public interface, and the second type of public interface is used to create an integration library instance object of the target algorithm integration library. The processing module is further used to create an integration library instance object of the target algorithm integration library through the second type of public interface; wherein, the object identifier of the integration library instance object corresponds to the interface identifier of the target SDK interface, and the object identifier of the integration library instance object corresponds to the target algorithm integration library. Alternatively, the processing module is further configured to, after querying the visual processing capabilities supported by the target algorithm integration library through the first type of public interface, record a first mapping relationship between the SDK interface object instance and the target algorithm integration library; the processing module is further configured to, when creating the SDK interface object instance for the target SDK interface, obtain the target algorithm integration library corresponding to the SDK interface object instance by reading the first mapping relationship; create an integration library instance object of the target algorithm integration library through the second type of public interface of the target algorithm integration library, and record a second mapping relationship between the interface identifier of the target SDK interface and the object identifier of the integration library instance object; Alternatively, when determining the target algorithm integration library corresponding to the interface identifier of the target SDK interface, the determining module is specifically used to: query the second mapping relationship based on the interface identifier of the target SDK interface to obtain the object identifier of the integration library instance object corresponding to the interface identifier of the target SDK interface; and determine the target algorithm integration library based on the object identifier of the integration library instance object. Alternatively, the public interface includes a third type of public interface, and the third type of public interface is used to destroy the integration library instance object of the target algorithm integration library. The processing module is also used to destroy the integration library instance object of the target algorithm integration library through the third type of public interface, so as to stop the processing of the image to be processed by calling the target algorithm integration library through the destroyed integration library instance object. Alternatively, the processing module is further configured to query the visual processing capabilities supported by the first algorithm integration library through the first type of public interface of the first algorithm integration library to be added, record the mapping relationship between the first SDK interface object instance and the first algorithm integration library, wherein the first SDK interface object instance corresponds to the visual processing capability; create the first SDK interface object instance for the first SDK interface of the SDK interface layer, and obtain the first algorithm integration library corresponding to the first SDK interface object instance by reading the mapping relationship; create an integration library instance object of the first algorithm integration library through the second type of public interface of the first algorithm integration library, and record the mapping relationship between the interface identifier of the first SDK interface and the object identifier of the integration library instance object, wherein the object identifier of the integration library instance object corresponds to the first algorithm integration library; Alternatively, the processing module is further configured to, when destroying the second SDK interface object instance for the second SDK interface of the SDK interface layer, obtain the first algorithm integration library corresponding to the second SDK interface object instance by reading the mapping relationship; destroy the integration library instance object of the second algorithm integration library through the third type of public interface of the second algorithm integration library; and destroy the second algorithm integration library after the integration library instance object is destroyed.
13. An electronic device, characterized in that, include: A processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; The processor is configured to execute machine-executable instructions to implement the method of any one of claims 1-8.