gpt4 book ai didi

c++ - opencv的private.hpp是什么??哪个模块包含 private.hpp 文件?

转载 作者:太空宇宙 更新时间:2023-11-03 22:16:39 25 4
gpt4 key购买 nike

<分区>

我下载了 opencv 411 版本的 Master Branch 和 Extra 模块源。

首先,将额外的模块复制到 master 并将配置设置为 msvs2015 x64 作为 cmake。

然后我们打开Opencv.sln并构建一个安装工程。

项目构建成功。

然后我从 opencv 教程中得到一个测试代码:https://docs.opencv.org/3.0-beta/modules/line_descriptor/doc/tutorial.html

#include <opencv2/line_descriptor.hpp>

#include "opencv2/core/utility.hpp"
#include "opencv2/core/private.hpp"
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/highgui.hpp>

#include <iostream>

using namespace cv;
using namespace std;

static const char* keys =
{ "{@image_path | | Image path }" };

static void help()
{
cout << "\nThis example shows the functionalities of lines extraction " << "furnished by BinaryDescriptor class\n"
<< "Please, run this sample using a command in the form\n" << "./example_line_descriptor_lines_extraction <path_to_input_image>" << endl;
}

int main( int argc, char** argv )
{
/* get parameters from comand line */
CommandLineParser parser( argc, argv, keys );
String image_path = parser.get<String>( 0 );

if( image_path.empty() )
{
help();
return -1;
}

/* load image */
cv::Mat imageMat = imread( image_path, 1 );
if( imageMat.data == NULL )
{
std::cout << "Error, image could not be loaded. Please, check its path" << std::endl;
}

/* create a ramdom binary mask */
cv::Mat mask = Mat::ones( imageMat.size(), CV_8UC1 );

/* create a pointer to a BinaryDescriptor object with deafult parameters */
Ptr<BinaryDescriptor> bd = BinaryDescriptor::createBinaryDescriptor();

/* create a structure to store extracted lines */
vector<KeyLine> lines;

/* extract lines */
bd->detect( imageMat, lines, mask );

/* draw lines extracted from octave 0 */
cv::Mat output = imageMat.clone();
if( output.channels() == 1 )
cvtColor( output, output, COLOR_GRAY2BGR );
for ( size_t i = 0; i < lines.size(); i++ )
{
KeyLine kl = lines[i];
if( kl.octave == 0)
{
/* get a random color */
int R = ( rand() % (int) ( 255 + 1 ) );
int G = ( rand() % (int) ( 255 + 1 ) );
int B = ( rand() % (int) ( 255 + 1 ) );

/* get extremes of line */
Point pt1 = Point( kl.startPointX, kl.startPointY );
Point pt2 = Point( kl.endPointX, kl.endPointY );

/* draw line */
line( output, pt1, pt2, Scalar( B, G, R ), 5 );
}

}

/* show lines on image */
imshow( "Lines", output );
waitKey();
}

但是编译失败,错误信息如下:

Opencv2/core/private.hpp file not found.

当我检查时,private.hpp 文件没有在构建文件夹路径中的 install/include 文件夹中创建。

也许,在检查 cmake 的选项时,出现了缺少的模块。但是我不知道要创建一个private.hpp 文件的模块。

知道的请回复。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com