Developing a Plugin

  1. Click to create an empty project under MindX SDK Project or download a sample project under MindX SDK Samples from Gitee and import it, as shown in Figure 1.
    Figure 1 Developing an application using the MindX SDK
  2. Right-click the project name in the project directory on the IDE page and choose New MindX SDK Plugin from the shortcut menu. The dialog box shown in Figure 2 is displayed.
    Figure 2 Plugin creation dialog box
    • Plugin Name: user-defined plugin name.
    • Plugin Path: plugin creation directory. You are advised to place the plugin in the plugin directory of the project. If the directory does not exist, create it.
  3. After the project is created, check the following directory levels generated in the project directory. The value of Plugin Name is the plugin name set in Figure 2.
    └── plugin
       └── Plugin Name          // Plugin template.
            ├── Plugin Name.cpp
            ├── Plugin Name.h
            └── CMakeLists.txt
  4. In the CMakeLists.txt file (marked by 1 in the following figure) under the root project directory or the CMakeLists.txt file (marked by 2 in the following figure) under the C++ directory, add the location of the plugin CMakeLists.txt file marked by 3 in the following figure, to add the new plugin to the build process.
    The following uses the plugin mxpi_sample as an example.
    • Add the following information to the CMakeLists.txt file in the root directory of the project file:
      add_subdirectory("./plugin/mxpi_sample")

      ./plugin/mxpi_sample indicates the path of the CMakeLists.txt file of the new plugin relative to the CMakeLists.txt file in the root directory of the project file.

    • Add the following information to the CMakeLists.txt file in the C++ directory of the project file:
      add_subdirectory("../plugin/mxpi_sample")

      ../plugin/mxpi_sample indicates the path of the CMakeLists.txt file of the new plugin relative to the CMakeLists.txt file in the C++ directory of the project file.

    Figure 3 add_subdirectory

  5. After the build is complete, find the .so file generated in the root directory of the project file/lib/plugins, and set the file permission to 640.
  6. Develop a plugin. For details, see "Development Through Process Orchestration" in the mxVision User Guide.