Ask Your Question

_sparkle_eyes's profile - activity

2019-07-24 16:30:17 -0500 commented answer understand source code of LayerFactory

apologize for the late getaround, and thanks for the answer!

2019-07-24 16:30:01 -0500 received badge  Supporter (source)
2019-07-24 16:30:00 -0500 marked best answer understand source code of LayerFactory

Dear community,

I am having trouble understanding some details in the following chunk of C++ code:

 class CV_EXPORTS LayerFactory
{
public:

    //! Each Layer class must provide this function to the factory
    typedef Ptr<Layer>(*Constructor)(LayerParams &params);

    //! Registers the layer class with typename @p type and specified @p constructor. Thread-safe.
    static void registerLayer(const String &type, Constructor constructor);

    //! Unregisters registered layer with specified type name. Thread-safe.
    static void unregisterLayer(const String &type);

    /** @brief Creates instance of registered layer.
     *  @Param type type name of creating layer.
     *  @Param params parameters which will be used for layer initialization.
     *  @note Thread-safe.
     */
    static Ptr<Layer> createLayerInstance(const String &type, LayerParams& params);

private:
    LayerFactory();
};

In particular, I know this class has a registerLayer and an unregisterLayer member function, but I'm mostly confused about this line

typedef Ptr<Layer>(*Constructor)(LayerParams &params);

How to parse the syntax? What exactly is typedef defining? Why is there a *Constructor --- I can't find its definition anywhere in the source.

Thanks! This piece of code is from opencv/modules/dnn/include/opencv2/dnn/layer.hpp

2019-07-24 16:30:00 -0500 received badge  Scholar (source)
2019-03-21 17:10:46 -0500 asked a question understand source code of LayerFactory

understand source code of LayerFactory Dear community, I am having trouble understanding some details in the following

2019-03-02 21:38:15 -0500 commented answer drawContours vector<Point>

Thanks, this answer helps solve my problem.