Created
January 31, 2022 11:29
-
-
Save berak/2057d8e2251454d329e2168f78370739 to your computer and use it in GitHub Desktop.
calcHist python wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static PyObject* pyopencv_cv_calcHist(PyObject* , PyObject* py_args, PyObject* kw) | |
{ | |
using namespace cv; | |
pyPrepareArgumentConversionErrorsStorage(2); | |
{ | |
PyObject* pyobj_images = NULL; | |
vector_Mat images; | |
PyObject* pyobj_channels = NULL; | |
vector_int channels; | |
PyObject* pyobj_mask = NULL; | |
Mat mask; | |
PyObject* pyobj_hist = NULL; | |
Mat hist; | |
PyObject* pyobj_histSize = NULL; | |
vector_int histSize; | |
PyObject* pyobj_ranges = NULL; | |
vector_float ranges; | |
PyObject* pyobj_accumulate = NULL; | |
bool accumulate=false; | |
const char* keywords[] = { "images", "channels", "mask", "histSize", "ranges", "hist", "accumulate", NULL }; | |
if( PyArg_ParseTupleAndKeywords(py_args, kw, "OOOOO|OO:calcHist", (char**)keywords, &pyobj_images, &pyobj_channels, &pyobj_mask, &pyobj_histSize, &pyobj_ranges, &pyobj_hist, &pyobj_accumulate) && | |
pyopencv_to_safe(pyobj_images, images, ArgInfo("images", 0)) && | |
pyopencv_to_safe(pyobj_channels, channels, ArgInfo("channels", 0)) && | |
pyopencv_to_safe(pyobj_mask, mask, ArgInfo("mask", 0)) && | |
pyopencv_to_safe(pyobj_hist, hist, ArgInfo("hist", 1)) && | |
pyopencv_to_safe(pyobj_histSize, histSize, ArgInfo("histSize", 0)) && | |
pyopencv_to_safe(pyobj_ranges, ranges, ArgInfo("ranges", 0)) && | |
pyopencv_to_safe(pyobj_accumulate, accumulate, ArgInfo("accumulate", 0)) ) | |
{ | |
ERRWRAP2(cv::calcHist(images, channels, mask, hist, histSize, ranges, accumulate)); | |
return pyopencv_from(hist); | |
} | |
pyPopulateArgumentConversionErrors(); | |
} | |
{ | |
PyObject* pyobj_images = NULL; | |
vector_UMat images; | |
PyObject* pyobj_channels = NULL; | |
vector_int channels; | |
PyObject* pyobj_mask = NULL; | |
UMat mask; | |
PyObject* pyobj_hist = NULL; | |
UMat hist; | |
PyObject* pyobj_histSize = NULL; | |
vector_int histSize; | |
PyObject* pyobj_ranges = NULL; | |
vector_float ranges; | |
PyObject* pyobj_accumulate = NULL; | |
bool accumulate=false; | |
const char* keywords[] = { "images", "channels", "mask", "histSize", "ranges", "hist", "accumulate", NULL }; | |
if( PyArg_ParseTupleAndKeywords(py_args, kw, "OOOOO|OO:calcHist", (char**)keywords, &pyobj_images, &pyobj_channels, &pyobj_mask, &pyobj_histSize, &pyobj_ranges, &pyobj_hist, &pyobj_accumulate) && | |
pyopencv_to_safe(pyobj_images, images, ArgInfo("images", 0)) && | |
pyopencv_to_safe(pyobj_channels, channels, ArgInfo("channels", 0)) && | |
pyopencv_to_safe(pyobj_mask, mask, ArgInfo("mask", 0)) && | |
pyopencv_to_safe(pyobj_hist, hist, ArgInfo("hist", 1)) && | |
pyopencv_to_safe(pyobj_histSize, histSize, ArgInfo("histSize", 0)) && | |
pyopencv_to_safe(pyobj_ranges, ranges, ArgInfo("ranges", 0)) && | |
pyopencv_to_safe(pyobj_accumulate, accumulate, ArgInfo("accumulate", 0)) ) | |
{ | |
ERRWRAP2(cv::calcHist(images, channels, mask, hist, histSize, ranges, accumulate)); | |
return pyopencv_from(hist); | |
} | |
pyPopulateArgumentConversionErrors(); | |
} | |
pyRaiseCVOverloadException("calcHist"); | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment