基本上我试图将下面的输出图像转换为颜色(RGB).此代码当前输出的图像是灰度,但是,对于我的应用程序,我希望它作为颜色输出.请让我知道我应该在哪里转换图像.
下面的代码也是C++,它使用openCV中的函数.请记住,我正在使用包装器在我的iphone应用程序中使用此代码.
cv::Mat CVCircles::detectedCirclesInImage(cv::Mat img, double dp, double minDist, double param1, double param2, int min_radius, int max_radius) {
//(cv::Mat img, double minDist, int min_radius, int max_radius)
if(img.empty())
{
cout << "can not open image " << endl;
return img;
}
Mat cimg;
medianBlur(img, img, 5);
cvtColor(img, cimg, CV_GRAY2RGB);
vector<Vec3f> circles;
HoughCircles( img //InputArray
, circles //OutputArray
, CV_HOUGH_GRADIENT //int method
, 1//dp //double dp=1 1 ... 20
, minDist //double minDist=10 log 1...1000
, 100//param1 //double param1=100
, 30//param2 //double …Run Code Online (Sandbox Code Playgroud) 我从OpenCV 获得了预编译的opencv2.framework,并将其添加到我的项目中.但是,尝试编译项目会产生以下错误:
Undefined symbols for architecture armv7:
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 128>, std::__1::allocator<cv::Vec<int, 128> > >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 64>, std::__1::allocator<cv::Vec<int, 64> > >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 32>, std::__1::allocator<cv::Vec<int, 32> > >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 16>, std::__1::allocator<cv::Vec<int, 16> > >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 12>, std::__1::allocator<cv::Vec<int, 12> > >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 9>, std::__1::allocator<cv::Vec<int, 9> > >::__append(unsigned long) in opencv2(matrix.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, …Run Code Online (Sandbox Code Playgroud) 我正在尝试将最新版本的openCV添加到我的iOS项目中,但是当我编译时,我得到大约30个链接错误:
例:
Undefined symbols for architecture i386:
"cv::merge(std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::_OutputArray const&)", referenced from:
Run Code Online (Sandbox Code Playgroud)
我在一个带有简单视频捕获的虚拟应用程序中添加了OpenCV框架以及所有其他必需的框架(遵循链接中的教程),并且它工作得很好.
我不确定为什么它可以在一个地方如此顺利地工作,但不能在另一个地方工作.我唯一的想法是我在两个应用程序之间编译不同的架构,但我认为两者都是针对armv7和armv7s.
有什么可能导致链接错误的想法?