Merge pull request #2922 from ilya-lavrenov:mac_fix
This commit is contained in:
@@ -60,8 +60,6 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string combine(const std::string& _item1, const std::string& _item2);
|
std::string combine(const std::string& _item1, const std::string& _item2);
|
||||||
std::string combine_format(const std::string& item1, const std::string& item2, ...);
|
|
||||||
|
|
||||||
cv::Mat mergeRectification(const cv::Mat& l, const cv::Mat& r);
|
cv::Mat mergeRectification(const cv::Mat& l, const cv::Mat& r);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -427,10 +425,10 @@ TEST_F(fisheyeTest, rectify)
|
|||||||
|
|
||||||
cv::Mat rectification = mergeRectification(lundist, rundist);
|
cv::Mat rectification = mergeRectification(lundist, rundist);
|
||||||
|
|
||||||
cv::Mat correct = cv::imread(combine_format(datasets_repository_path, "rectification_AB_%03d.png", i));
|
cv::Mat correct = cv::imread(combine(datasets_repository_path, cv::format("rectification_AB_%03d.png", i)));
|
||||||
|
|
||||||
if (correct.empty())
|
if (correct.empty())
|
||||||
cv::imwrite(combine_format(datasets_repository_path, "rectification_AB_%03d.png", i), rectification);
|
cv::imwrite(combine(datasets_repository_path, cv::format("rectification_AB_%03d.png", i)), rectification);
|
||||||
else
|
else
|
||||||
EXPECT_MAT_NEAR(correct, rectification, 1e-10);
|
EXPECT_MAT_NEAR(correct, rectification, 1e-10);
|
||||||
}
|
}
|
||||||
@@ -599,17 +597,6 @@ std::string fisheyeTest::combine(const std::string& _item1, const std::string& _
|
|||||||
return item1 + (last != '/' ? "/" : "") + item2;
|
return item1 + (last != '/' ? "/" : "") + item2;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fisheyeTest::combine_format(const std::string& item1, const std::string& item2, ...)
|
|
||||||
{
|
|
||||||
std::string fmt = combine(item1, item2);
|
|
||||||
char buffer[1 << 16];
|
|
||||||
va_list args;
|
|
||||||
va_start( args, item2 );
|
|
||||||
vsprintf( buffer, fmt.c_str(), args );
|
|
||||||
va_end( args );
|
|
||||||
return std::string(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::Mat fisheyeTest::mergeRectification(const cv::Mat& l, const cv::Mat& r)
|
cv::Mat fisheyeTest::mergeRectification(const cv::Mat& l, const cv::Mat& r)
|
||||||
{
|
{
|
||||||
CV_Assert(l.type() == r.type() && l.size() == r.size());
|
CV_Assert(l.type() == r.type() && l.size() == r.size());
|
||||||
|
|||||||
@@ -450,13 +450,12 @@ double CvCaptureCAM::getProperty(int property_id){
|
|||||||
QTFormatDescription* format = [[connections objectAtIndex:0] formatDescription];
|
QTFormatDescription* format = [[connections objectAtIndex:0] formatDescription];
|
||||||
NSSize s1 = [[format attributeForKey:QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute] sizeValue];
|
NSSize s1 = [[format attributeForKey:QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute] sizeValue];
|
||||||
|
|
||||||
int width=s1.width, height=s1.height;
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case CV_CAP_PROP_FRAME_WIDTH:
|
case CV_CAP_PROP_FRAME_WIDTH:
|
||||||
retval = width;
|
retval = s1.width;
|
||||||
break;
|
break;
|
||||||
case CV_CAP_PROP_FRAME_HEIGHT:
|
case CV_CAP_PROP_FRAME_HEIGHT:
|
||||||
retval = height;
|
retval = s1.height;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
@@ -1013,22 +1012,22 @@ bool CvVideoWriter_QT::writeFrame(const IplImage* image) {
|
|||||||
cvCvtColor(image, argbimage, CV_BGR2BGRA);
|
cvCvtColor(image, argbimage, CV_BGR2BGRA);
|
||||||
|
|
||||||
|
|
||||||
unsigned char* imagedata = (unsigned char*)argbimage->imageData;
|
unsigned char* imagedata_ = (unsigned char*)argbimage->imageData;
|
||||||
//BGRA --> ARGB
|
//BGRA --> ARGB
|
||||||
|
|
||||||
for (int j = 0; j < argbimage->height; j++) {
|
for (int j = 0; j < argbimage->height; j++) {
|
||||||
int rowstart = argbimage->widthStep * j;
|
int rowstart = argbimage->widthStep * j;
|
||||||
for (int i = rowstart; i < rowstart+argbimage->widthStep; i+=4) {
|
for (int i = rowstart; i < rowstart+argbimage->widthStep; i+=4) {
|
||||||
unsigned char temp = imagedata[i];
|
unsigned char temp = imagedata_[i];
|
||||||
imagedata[i] = 255;
|
imagedata_[i] = 255;
|
||||||
imagedata[i+3] = temp;
|
imagedata_[i+3] = temp;
|
||||||
temp = imagedata[i+2];
|
temp = imagedata_[i+2];
|
||||||
imagedata[i+2] = imagedata[i+1];
|
imagedata_[i+2] = imagedata_[i+1];
|
||||||
imagedata[i+1] = temp;
|
imagedata_[i+1] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&imagedata
|
NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&imagedata_
|
||||||
pixelsWide:movieSize.width
|
pixelsWide:movieSize.width
|
||||||
pixelsHigh:movieSize.height
|
pixelsHigh:movieSize.height
|
||||||
bitsPerSample:8
|
bitsPerSample:8
|
||||||
|
|||||||
@@ -6,6 +6,17 @@
|
|||||||
#if defined(HAVE_OPENCL_STATIC)
|
#if defined(HAVE_OPENCL_STATIC)
|
||||||
|
|
||||||
#if defined __APPLE__
|
#if defined __APPLE__
|
||||||
|
// APPLE ignores CL_USE_DEPRECATED_OPENCL_1_1_APIS so use this hack:
|
||||||
|
#include <OpenCL/cl_platform.h>
|
||||||
|
#ifdef CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
||||||
|
#undef CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
||||||
|
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
||||||
|
#endif
|
||||||
|
#ifdef CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
|
||||||
|
#undef CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
|
||||||
|
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <OpenCL/cl.h>
|
#include <OpenCL/cl.h>
|
||||||
#else
|
#else
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
|
|||||||
@@ -278,6 +278,16 @@ TEST_F(SuperResolution, BTVL1_GPU)
|
|||||||
#if defined(HAVE_OPENCV_OCL) && defined(HAVE_OPENCL)
|
#if defined(HAVE_OPENCV_OCL) && defined(HAVE_OPENCL)
|
||||||
TEST_F(SuperResolution, BTVL1_OCL)
|
TEST_F(SuperResolution, BTVL1_OCL)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const cv::ocl::DeviceInfo& dev = cv::ocl::Context::getContext()->getDeviceInfo();
|
||||||
|
std::cout << "Device name:" << dev.deviceName << std::endl;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cout << "Device name: N/A" << std::endl;
|
||||||
|
return; // skip test
|
||||||
|
}
|
||||||
RunTest(cv::superres::createSuperResolution_BTVL1_OCL());
|
RunTest(cv::superres::createSuperResolution_BTVL1_OCL());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user