2012-09-25 1 views
0

누군가이 오류와 관련해 도움을 줄 수 있습니까?Visual C++ express 2010 프로 시저 엔트리 포인트 ?? 1task_group_context @ tbb @@ QAE @ XZ를 동적 링크 라이브러리 tbb.dll에 위치시킬 수 없습니다.

나는 인터넷에 연구 노력하고 문제를 해결하기 위해 다양한 방법을 시도 (예 : 등, 코드를 추가, Visual C++에서 다른 버전의 제거),하지만 그들 중 누구도 일 :(

을 보이지 않는다 내가 수행 한 :

under c/c++-->general-->additional include directories-->C:\OpenCV2.3\build\include;C:\OpenCV2.3\build\include\opencv2;C:\OpenCV2.3\build\include\opencv;C:\OpenCV2.3\opencv\data\haarcascades 

under linker-->general-->additional library directories-->C:\OpenCV2.3\build\x86\vc9\lib;C:\OpenCV2.3\opencv\data\haarcascades;%(AdditionalLibraryDirectories) 

under linker-->input-->additional dependencies--> added opencv_core230.lib;opencv_highgui230.lib;opencv_objdetect230.lib 

under debugging-->command arguments -->added --cascade="C:/Program Files/OpenCV/data/haarcascades/haarcascade_frontalface_alt.xml"testimg.jpg 

코드 :.

#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 memory for calculations 
static CvMemStorage* storage = 0; 

// Create a new Haar classifier 
static CvHaarClassifierCascade* cascade = 0; 

// Function prototype for detecting and drawing an object from an image 
void detect_and_draw(IplImage* image); 

// Create a string that contains the cascade name 
const char* cascade_name = "haarcascade_frontalface_alt.xml"; 
/* "haarcascade_profileface.xml";*/ 

// Main function, defines the entry point for the program. 
int main(int argc, char** argv) 
{ 
    // Structure for getting video from camera or avi 
    CvCapture* capture = 0; 

    // Images to capture the frame from video or camera or from file 
    IplImage *frame, *frame_copy = 0; 
    /* IplImage* img = cvLoadImage("testimg.jpg"); 
    cvNamedWindow("MyJPG", CV_WINDOW_AUTOSIZE); 
    cvShowImage("MyJPG", img); 
    cvWaitKey(0); 
    cvReleaseImage(&img); 
    cvDestroyWindow("MyJPG"); 
    */ 
    // Used for calculations 
    int optlen = strlen("--cascade="); 

    // Input file name for avi or image file. 
    const char* input_name; 

    // Check for the correct usage of the command line 
    if(argc > 1 && strncmp(argv[1], "--cascade=", optlen) == 0) 
    { 
     cascade_name = argv[1] + optlen; 
     input_name = argc > 2 ? argv[2] : 0; 
    } 
    else 
    { 
     fprintf(stderr, 
     "Usage: facedetect --cascade=\"<cascade_path>\" [filename|camera_index]\n"); 
     return -1; 
     /*input_name = argc > 1 ? argv[1] : 0;*/ 
    } 

    // 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 -1; 
    } 

    // Allocate the memory storage 
    storage = cvCreateMemStorage(0); 

    // Find whether to detect the object from file or from camera. 
    if(!input_name || (isdigit(input_name[0]) && input_name[1] == '\0')) 
     capture = cvCaptureFromCAM(!input_name ? 0 : input_name[0] - '0'); 
    else 
     capture = cvCaptureFromAVI(input_name); 

    // Create a new named window with title: result 
    cvNamedWindow("result", 1); 

    // Find if the capture is loaded successfully or not. 

    // If loaded succesfully, then: 
    if(capture) 
    { 
     // Capture from the camera. 
     for(;;) 
     { 
      // Capture the frame and load it in IplImage 
      if(!cvGrabFrame(capture)) 
       break; 
      frame = cvRetrieveFrame(capture); 

      // If the frame does not exist, quit the loop 
      if(!frame) 
       break; 

      // Allocate framecopy as the same size of the frame 
      if(!frame_copy) 
       frame_copy = cvCreateImage(cvSize(frame->width,frame->height), 
              IPL_DEPTH_8U, frame->nChannels); 

      // Check the origin of image. If top left, copy the image frame to frame_copy. 
      if(frame->origin == IPL_ORIGIN_TL) 
       cvCopy(frame, frame_copy, 0); 
      // Else flip and copy the image 
      else 
       cvFlip(frame, frame_copy, 0); 

      // Call the function to detect and draw the face 
      detect_and_draw(frame_copy); 

      // Wait for a while before proceeding to the next frame 
      if(cvWaitKey(10) >= 0) 
       break; 
     } 

     // Release the images, and capture memory 
     cvReleaseImage(&frame_copy); 
     cvReleaseCapture(&capture); 
    } 

    // If the capture is not loaded succesfully, then: 
    else 
    { 
     // Assume the image to be lena.jpg, or the input_name specified 
     const char* filename = input_name ? input_name : (char*)"testimg.jpg"; 

     // Load the image from that filename 
     IplImage* image = cvLoadImage(filename, 1); 

     // If Image is loaded succesfully, then: 
     if(image) 
     { 
      // Detect and draw the face 
      detect_and_draw(image); 

      // Wait for user input 
      cvWaitKey(0); 

      // Release the image memory 
      cvReleaseImage(&image); 
     } 
     else 
     { 
      /* assume it is a text file containing the 
       list of the image filenames to be processed - one per line */ 
      FILE* f = fopen(filename, "rt"); 
      if(f) 
      { 
       char buf[1000+1]; 

       // Get the line from the file 
       while(fgets(buf, 1000, f)) 
       { 

        // Remove the spaces if any, and clean up the name 
        int len = (int)strlen(buf); 
        while(len > 0 && isspace(buf[len-1])) 
         len--; 
        buf[len] = '\0'; 

        // Load the image from the filename present in the buffer 
        image = cvLoadImage(buf, 1); 

        // If the image was loaded succesfully, then: 
        if(image) 
        { 
         // Detect and draw the face from the image 
         detect_and_draw(image); 

         // Wait for the user input, and release the memory 
         cvWaitKey(0); 
         cvReleaseImage(&image); 
        } 
       } 
       // Close the file 
       fclose(f); 
      } 
     }  
    } 

    // 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) 
{ 
    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; 

    // 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); 
} 

답변

1

오류 메시지가 특정 기호가 외부 라이브러리에 tbb.dll을 찾을 수 없음을 말한다 리튬을 brary (dll) 자체가 발견 된 것 같습니다.

라이브러리가 Threading building blocks이고 여러 버전이 설치되어 있기 때문에 예를 들어 헤더와 사용 된 dll의 불일치에 대한 오류 메시지가 표시됩니다. 런타임시 올바른 dll이 사용되면 알아 두어야합니다 (모듈 창 확인 VS에, 아니면 Dependency Walker을 사용하십시오). 런타임 응용 프로그램이 tbb.dll의 올바른 경로를 가리 키도록하려면 PATH 환경 변수에 디렉터리를 저장하거나 tbb.dll을 실행 파일과 나란히 놓습니다.

관련 문제