Skip to content

Instantly share code, notes, and snippets.

@mguludag
Created July 17, 2020 15:53
Show Gist options
  • Select an option

  • Save mguludag/58dad11c55d1f179fc5b465fd44ed6e6 to your computer and use it in GitHub Desktop.

Select an option

Save mguludag/58dad11c55d1f179fc5b465fd44ed6e6 to your computer and use it in GitHub Desktop.
#ifndef MYCROPLAYER_HPP
#define MYCROPLAYER_HPP
#include <opencv2/core.hpp>
#include <opencv2/dnn.hpp>
#include <opencv2/dnn/layer.details.hpp>
#include <opencv2/dnn/shape_utils.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>
class MyCropLayer : public cv::dnn::Layer
{
public:
explicit MyCropLayer(const cv::dnn::LayerParams &params);
static cv::Ptr<cv::dnn::Layer> create(cv::dnn::LayerParams &params);
virtual bool getMemoryShapes(const std::vector<std::vector<int>> &inputs,
const int requiredOutputs,
std::vector<std::vector<int>> &outputs,
std::vector<std::vector<int>> &internals) const CV_OVERRIDE;
virtual void forward(std::vector<cv::Mat *> &input,
std::vector<cv::Mat> &output,
std::vector<cv::Mat> &internals) CV_OVERRIDE;
virtual void forward(cv::InputArrayOfArrays inputs_arr,
cv::OutputArrayOfArrays outputs_arr,
cv::OutputArrayOfArrays internals_arr) CV_OVERRIDE;
};
#endif // MYCROPLAYER_HPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment