Commit 2c1e913b authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

added 16-bit support to Bayer2RGB & Bayer2Gray (ticket #686); fixed bug in…

added 16-bit support to Bayer2RGB & Bayer2Gray (ticket #686); fixed bug in cv.CreateHist() when no ranges are passed (ticket #990)
parent 2609df00
This diff is collapsed.
#include "test_precomp.hpp" #include "test_precomp.hpp"
CV_TEST_MAIN("cv") CV_TEST_MAIN("cv")
#if 0
using namespace cv;
using namespace std;
int main(int, char**)
{
#if 0
Mat src = imread("/Users/vp/Downloads/resize/original.png"), dst;
//resize(src, dst, Size(), 0.25, 0.25, INTER_NEAREST);
//imwrite("/Users/vp/Downloads/resize/xnview_nn_opencv.png", dst);
printf("\n\n\n\n\n\n***************************************\n");
//resize(src, dst, Size(), 0.25, 0.25, INTER_AREA);
//int nsteps = 4;
//double rate = pow(0.25,1./nsteps);
//for( int i = 0; i < nsteps; i++ )
// resize(src, src, Size(), rate, rate, INTER_LINEAR );
//GaussianBlur(src, src, Size(5, 5), 2, 2);
resize(src, src, Size(), 0.25, 0.25, INTER_NEAREST);
imwrite("/Users/vp/Downloads/resize/xnview_bilinear_opencv.png", src);
//resize(src, dst, Size(), 0.25, 0.25, INTER_LANCZOS4);
//imwrite("/Users/vp/Downloads/resize/xnview_lanczos3_opencv.png", dst);
#else
float data[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
Mat src(5,5,CV_32FC1, data);
Mat dst;
resize(src, dst, Size(), 3, 3, INTER_NEAREST);
cout << src << endl;
cout << dst << endl;
#endif
return 0;
}
#endif
...@@ -2965,16 +2965,20 @@ static PyObject *pycvCreateHist(PyObject *self, PyObject *args, PyObject *kw) ...@@ -2965,16 +2965,20 @@ static PyObject *pycvCreateHist(PyObject *self, PyObject *args, PyObject *kw)
} }
cvhistogram_t *h = PyObject_NEW(cvhistogram_t, &cvhistogram_Type); cvhistogram_t *h = PyObject_NEW(cvhistogram_t, &cvhistogram_Type);
args = Py_BuildValue("Oi", dims, CV_32FC1); args = Py_BuildValue("Oi", dims, CV_32FC1);
memset(&h->h, 0, sizeof(h->h));
h->bins = pycvCreateMatND(self, args); h->bins = pycvCreateMatND(self, args);
Py_DECREF(args); Py_DECREF(args);
if (h->bins == NULL) { if (h->bins == NULL) {
return NULL; return NULL;
} }
h->h.type = CV_HIST_MAGIC_VAL; h->h.type = CV_HIST_MAGIC_VAL + CV_HIST_UNIFORM_FLAG;
if (!convert_to_CvArr(h->bins, &(h->h.bins), "bins")) if (!convert_to_CvArr(h->bins, &(h->h.bins), "bins"))
return NULL; return NULL;
ERRWRAP(cvSetHistBinRanges(&(h->h), r.rr, uniform)); if(r.rr)
{
ERRWRAP(cvSetHistBinRanges(&(h->h), r.rr, uniform));
}
return (PyObject*)h; return (PyObject*)h;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment