1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-23 09:38:56 +08:00
Files
opencv_contrib/modules/dnn/misc/python/pyopencv_dnn.hpp
Vadim Pisarevsky 3f5b465501 refactored DNN (#1102)
* the first commit in the merged dnn: convert some public API from Blob's to Mat's

* temporarily or permantently removed OpenCL optimizations, which are not always stable nor usually very efficient; we'll likely use Halide instead

* got rid of Blob and BlobShape completely; use cv::Mat and std::vector<int> instead

* fixed a few compile errors

* got rid of separate .hpp files with layer declarations; instead, put everything into the respective .cpp files

* normalized all the layers' constructors; we concentrate on loading deep networks layers from files instead of constructing them from scratch, so we retained only SomeLayer::SomeLayer(const LayerParams& params); constructors

* fixed sample compilation

* suppress doxygen warnings

* trying to fix python bindings generation for DNN module

* temporarily disable python bindings while we refactor the module

* fix win32/win64 compile errors; remove trailing whitespaces

* fix win32/win64 compile errors; remove trailing whitespaces
2017-04-25 09:33:51 +03:00

30 lines
632 B
C++

#ifdef HAVE_OPENCV_DNN
typedef dnn::DictValue LayerId;
template<>
bool pyopencv_to(PyObject *o, dnn::DictValue &dv, const char *name)
{
(void)name;
if (!o || o == Py_None)
return true; //Current state will be used
else if (PyLong_Check(o))
{
dv = dnn::DictValue((int64)PyLong_AsLongLong(o));
return true;
}
else if (PyFloat_Check(o))
{
dv = dnn::DictValue(PyFloat_AS_DOUBLE(o));
return true;
}
else if (PyString_Check(o))
{
dv = dnn::DictValue(String(PyString_AsString(o)));
return true;
}
else
return false;
}
#endif