Got Error in Program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <opencv/highgui.h>
#include <opencv/cv.h>
#include <tchar.h>

int _tmain(int argc, _TCHAR* argv[])
{

blobs = CBlobResult( img, NULL, 10 0, NULL ); //store detected objects
int blobnum = blobs.GetNumBlobs();
cvInitFont (&dfont, CV_FONT_HERSHEY_SIMPLEX , hscale, vscale, italicscale, thickness, CV_AA);
CBlobGetXCenter x_center;
CBlobGetYCenter y_center;
//filter object detected with central point as black pixel
for(int i = 0; i < blobnum; i++)
{ blob_current = blobs.GetBlob(i);
p3.x = x_center.operator()(blob_current);
p3.y = y_center.operator()(blob_current);
if (blob_current.ExternPerimeter()==0)
{ if (s3.val[0] != 0)
{
final_blobs.AddBlob(&blob_current);
}
}
}
int final_blobNum = final_blobs.GetNumBlobs();
for(int i = 0; i < final_blobNum; i++)
{
blob = final_blobs.GetBlob(i);
p1.x = (int)blob.MinX();
p1.y = (int)blob.MinY();
p2.x = (int)blob.MaxX();
p2.y = (int)blob.MaxY();
//draw the selected candidates
sprintf(text, "%d", i+1);
cvPutText(img2, text, cvPoint(p1.x, p2.y + 15),&dfont,CV_RGB(100,100,100));
cvRectangle( img2, p1, p2, CV_RGB( 100, 100, 100 ), 1, 8, 0 );
}

return 0;

}


Hi, I'm still new in this OpenCV, may I know why my above program cannot run properly? This is some of the error I get...thanks...

c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(8): error C2065: 'blobs' : undeclared identifier
1>c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(8): error C2065: 'img' : undeclared identifier
1>c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(8): error C2143: syntax error : missing ')' before 'constant'
1>c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(8): error C2059: syntax error : ')'
1>c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(9): error C2065: 'blobs' : undeclared identifier
1>c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(9): error C2228: left of '.GetNumBlobs' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(8): error C3861: 'CBlobResult': identifier not found
1>c:\users\128a5s5\documents\visual studio 2010\projects\32\32\32.cpp(10): error C2065: 'dfont' : undeclared identifier
Last edited on
blobs = CBlobResult( img, NULL, 10 0, NULL ); //store detected objects

And what is blobs? Is it an int? A double? A float? A string? You have to create objects before you can use them. How is the compiler supposed to know what kind of object this is?

Likewise img and dfont.
Thanks...

Got any library for CBlobResult, CBlobGetXCenter, blob_current, blobs, final_blobs? TQ
A library won't help. You need to create them. Here is how you would create an int:
int x;

Whatever this blobs thing is meant to be, you'll have to create it. Time to read the manual.
Topic archived. No new replies allowed.