- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试构建以下示例代码:
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <float.h>
#include <limits.h>
#include <time.h>
#include <ctype.h>
// Create a string that contains the exact cascade name
const char* cascade_name = "/usr/share/src/OpenCV-2.3.1/data/haarcascades/haarcascade_frontalface_alt.xml";
// "C:/Program Files/OpenCV/data/haarcascades/haarcascade_frontalface_alt.xml";
/* "haarcascade_profileface.xml";*/
// Function prototype for detecting and drawing an object from an image
void detect_and_draw( IplImage* image );
// Main function, defines the entry point for the program.
int main( int argc, char** argv )
{
// Create a sample image
IplImage *img = cvLoadImage("1.pgm");
// Call the function to detect and draw the face positions
detect_and_draw(img);
// Wait for user input before quitting the program
cvWaitKey();
// Release the image
cvReleaseImage(&img);
// Destroy the window previously created with filename: "result"
cvDestroyWindow("result");
// return 0 to indicate successfull execution of the program
return 0;
}
// Function to detect and draw any faces that is present in an image
void detect_and_draw( IplImage* img )
{
// Create memory for calculations
static CvMemStorage* storage = 0;
// Create a new Haar classifier
static CvHaarClassifierCascade* cascade = 0;
int scale = 1;
// Create a new image based on the input image
IplImage* temp = cvCreateImage( cvSize(img->width/scale,img->height/scale), 8, 3 );
// Create two points to represent the face locations
CvPoint pt1, pt2;
int i;
// Load the HaarClassifierCascade
cascade = (CvHaarClassifierCascade*)cvLoad( cascade_name, 0, 0, 0 );
// Check whether the cascade has loaded successfully. Else report and error and quit
if( !cascade )
{
fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
return;
}
// Allocate the memory storage
storage = cvCreateMemStorage(0);
// Create a new named window with title: result
cvNamedWindow( "result", 1 );
// Clear the memory storage which was used before
cvClearMemStorage( storage );
// Find whether the cascade is loaded, to find the faces. If yes, then:
if( cascade )
{
// There can be more than one face in an image. So create a growable sequence of faces.
// Detect the objects and store them in the sequence
CvSeq* faces = cvHaarDetectObjects( img, cascade, storage,
1.1, 2, CV_HAAR_DO_CANNY_PRUNING,
cvSize(40, 40) );
// Loop the number of faces found.
for( i = 0; i < (faces ? faces->total : 0); i++ )
{
// Create a new rectangle for drawing the face
CvRect* r = (CvRect*)cvGetSeqElem( faces, i );
// Find the dimensions of the face,and scale it if necessary
pt1.x = r->x*scale;
pt2.x = (r->x+r->width)*scale;
pt1.y = r->y*scale;
pt2.y = (r->y+r->height)*scale;
// Draw the rectangle in the input image
cvRectangle( img, pt1, pt2, CV_RGB(255,0,0), 3, 8, 0 );
}
}
// Show the image in the window named "result"
cvShowImage( "result", img );
// Release the temp image created.
cvReleaseImage( &temp );
}
路径/usr/share/src.... 是 xml 文件所在的正确路径。我已将 opencv 库:opencv_core、opencv_imgproc、opencv_highgui 和 opencv_video 链接到 eclipse(我认为它们已正确链接,因为我以这种方式构建了其他 opencv 项目)。但是 Eclipse 不断抛出以下错误:
Invoking: MacOS X C++ Linker
g++ -L/usr/local/include/opencv -L/usr/local/include/opencv2 -L/usr/local/lib -o "OpenCVFace" ./main.o -lopencv_core -lopencv_highgui -lopencv_video -lopencv_imgproc
Undefined symbols for architecture x86_64:
"_cvHaarDetectObjects", referenced from:
detect_and_draw(_IplImage*) in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [OpenCVFace] Error 1
**** Build Finished ****
我可以看到 cvHaarDetectObjects 函数在 Eclipse 中突出显示(变为紫色)。关于如何解决问题的任何想法?谢谢!
最佳答案
您需要链接到opencv_objdetect
;在链接标志中包含 -lopencv_objdetect
。
关于opencv - 体系结构 x86_64 : "_cvHaarDetectObjects" Eclipse 的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11303826/
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我遇到了这两个文档(它们是用意大利语写的,尽管代码注释是英文的): http://home.deib.polimi.it/brandole/acsocr/L13%20-%20Generic%20Ass
我的主要目标是提供一个用 jquery 编写的基于 solr 的搜索应用程序。 (不熟悉solr的,就假设它是一个可以返回搜索结果的rest api。)为了这个目标,我编写了许多小型应用程序和 ser
这个问题是关于选择“正确”类型的NoSQL数据库的,我希望甚至可以根据我将在下面列出的一些需求/用例以及当前正在使用的传统RDBMS解决方案,讨论特定的数据库以及它们为什么适用。地点。时间长了一点,但
在 Java 中我运行: System.out.println(Math.log(249.0/251.0)); Output: -0.008000042667076265 在 C# 中我运行:<- 已
我目前正在考虑通过 Redux 将 Context 实现到我们的一个应用程序中,但是,我似乎找不到任何关于什么是大型应用程序的最佳结构的信息? Redux 有一个定义的方法来创建 reducer、ac
我正在使用 mailcore 框架,但收到错误消息“archtecture x86 的重复符号”以及“找不到选项的目录” 下面是错误日志。 Ld /Users/user/Library/Develop
关闭。这个问题是opinion-based .它目前不接受答案。 想改进这个问题?更新问题,以便 editing this post 可以用事实和引用来回答它. 11 个月前关闭。 Improve t
假设我正在从 C++ 移植代码并需要在 C# 中模拟相同的位移技术: 每当我执行位移时,我是否必须考虑架构的 Endain-ness? 最佳答案 没有。位移是一种纯粹的代数运算。它不比乘以二更依赖于平
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
关于架构 XXX 的重复符号有很多问题,但我没有得到我的问题的答案。在我的场景中,我使用 Cocoapod,并导入 FMDB,但是当我集成另一个第三方 SDK 时,当我构建项目时,出现如下错误: 是否
我无法编译我的 Xcode 项目,它有重复的 ParseFacebookUtilsV4 问题 这是我的苹果 Mach-O 链接器错误: duplicate symbol _llvm.cmdline i
我对使用 MFC 的内置文档 View 体系结构的必要性有疑问。我得到了一个基于对话框的旧项目,我必须在其中用框架替换主对话框并添加功能区。它有一种文档 View 架构,创建时没有内置类,我更愿意在新
我正在构建一个协作创作工具,该工具允许用户共同编辑信息空间,该信息空间是节点和链接的可视化。一个客户端应用程序中所做的更改需要反映到所有其他客户端中。由于它是可视化的,因此可能需要经常更新潜在的大数据
如果我在 Windows(x86 和 x64)下的 .NET 上运行涉及 System.Double 的复杂计算,然后在 Mono(Linux、Unix 等)上运行,绝对有保证 以在所有情况下得到完全
当我使用 Xcode 4.6 编译我的 iPhone 应用程序时,我看到一个奇怪的错误代码: "duplicate symbols for architecture i386". 我知道这个关于文件名
我最近询问了 System.Double,并被告知计算可能因平台/架构而异。不幸的是,我找不到任何信息来告诉我这是否适用于 System.Decimal。 对于任何特定的 decimal 计算,无论平
我有一些实体,例如:Customers、Orders、Invoices。 对于它们中的每一个,我都将它们的CRUD 操作 和一些其他界面分组为:ISvcCustomerMgmt、ISvcOrderMg
这个问题有点像一个池。我们正在尝试在使用 LINQ to SQL 之类的 ORM 时确定最佳架构。我们正在定义的架构是用于其他应用程序将通过直接引用 DLL 或通过 Web 服务访问的框架。我们有 .
请就如何为 Java web 应用程序做“插件”架构提出建议。 目前我们在 Tomcat servlet 容器中使用非常简单和标准的 Spring+Hibernate+Struts 2。 (使用 ma
我是一名优秀的程序员,十分优秀!