MYNT-EYE-S-SDK/include/mynteye/api/plugin.h

142 lines
3.1 KiB
C
Raw Normal View History

2018-05-10 09:46:34 +03:00
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2018-10-27 16:24:04 +03:00
#ifndef MYNTEYE_API_PLUGIN_H_
#define MYNTEYE_API_PLUGIN_H_
2018-05-08 06:12:45 +03:00
#pragma once
#include <cstdint>
2018-10-27 16:24:04 +03:00
#include <opencv2/core/core.hpp>
2018-05-08 06:12:45 +03:00
#include "mynteye/mynteye.h"
#ifndef MYNTEYE_PLUGIN_VERSION_CODE
#define MYNTEYE_PLUGIN_VERSION_CODE 0
#endif
MYNTEYE_BEGIN_NAMESPACE
class API;
2018-05-16 05:48:15 +03:00
struct Object;
2018-05-08 06:12:45 +03:00
2018-05-16 05:31:31 +03:00
/**
* The plugin which could implement processing by yourself.
*/
2018-05-08 06:12:45 +03:00
class MYNTEYE_API Plugin {
public:
Plugin() = default;
virtual ~Plugin() = 0;
2018-05-16 05:31:31 +03:00
/**
* Called when plugin created.
* @param api the API instacne.
*/
2018-05-08 06:12:45 +03:00
virtual void OnCreate(API *api) {
api_ = api;
}
2018-05-16 05:31:31 +03:00
/**
* Called when process rectify.
* @param in input object.
* @param out output object.
* @return `true` if you process rectify.
*/
2018-05-08 06:12:45 +03:00
virtual bool OnRectifyProcess(Object *const in, Object *const out) {
2018-09-11 05:19:25 +03:00
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
2018-05-08 06:12:45 +03:00
return false;
}
2018-05-16 05:31:31 +03:00
/**
* Called when process disparity.
* @param in input object.
* @param out output object.
* @return `true` if you process disparity.
*/
2018-05-08 06:12:45 +03:00
virtual bool OnDisparityProcess(Object *const in, Object *const out) {
2018-09-11 05:19:25 +03:00
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
2018-05-08 06:12:45 +03:00
return false;
}
2018-05-16 05:31:31 +03:00
/**
* Called when process normalized disparity.
* @param in input object.
* @param out output object.
* @return `true` if you process normalized disparity.
*/
2018-05-08 06:12:45 +03:00
virtual bool OnDisparityNormalizedProcess(
Object *const in, Object *const out) {
2018-09-11 05:19:25 +03:00
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
2018-05-08 06:12:45 +03:00
return false;
}
2018-05-16 05:31:31 +03:00
/**
* Called when process points.
* @param in input object.
* @param out output object.
* @return `true` if you process points.
*/
2018-05-08 06:12:45 +03:00
virtual bool OnPointsProcess(Object *const in, Object *const out) {
2018-09-11 05:19:25 +03:00
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
2018-05-08 06:12:45 +03:00
return false;
}
2018-05-16 05:31:31 +03:00
/**
* Called when process depth.
* @param in input object.
* @param out output object.
* @return `true` if you process depth.
*/
2018-05-08 06:12:45 +03:00
virtual bool OnDepthProcess(Object *const in, Object *const out) {
2018-09-11 05:19:25 +03:00
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
2018-05-08 06:12:45 +03:00
return false;
}
protected:
API *api_;
};
inline Plugin::~Plugin() = default;
using plugin_version_code_t = std::uint32_t();
using plugin_create_t = Plugin *();
using plugin_destroy_t = void(Plugin *);
MYNTEYE_END_NAMESPACE
extern "C" {
2018-05-16 05:31:31 +03:00
/**
* Get the plugin version code.
*/
2018-05-08 06:12:45 +03:00
MYNTEYE_API std::uint32_t plugin_version_code();
2018-05-16 05:31:31 +03:00
/**
* Create the plugin.
*/
2018-05-08 06:12:45 +03:00
MYNTEYE_API mynteye::Plugin *plugin_create();
2018-05-16 05:31:31 +03:00
/**
* Destroy the plugin.
*/
2018-05-08 06:12:45 +03:00
MYNTEYE_API void plugin_destroy(mynteye::Plugin *plugin);
2018-10-27 16:24:04 +03:00
2018-05-08 06:12:45 +03:00
}
2018-10-27 16:24:04 +03:00
#endif // MYNTEYE_API_PLUGIN_H_