473,796 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Undeclared identifier

Thanks for the help so far.
I have some problems left. One of them is an undeclared identifier, but
it's unclear to me why the compiler fights with me. It says

"iter: undeclared identifier"

I thought that the
identifier was clear: "int", or is int just the declaration, and the
identifier is something else?
Thanks a lot.
Anna

//=============== =============== =============== =============== =============== =
int AAM_IC::Fit(con st IplImage* image, AAM_Shape& Shape,
int max_iter /* = 30 */, bool showprocess /* = false */)
{
//initialize some stuff
double t = (double)cvGetTi ckCount();
CvMat p; cvGetCols(__sea rch_pq, &p, 4, 4+__shape.nMode s());
double e1(1e100), e2;
Shape.Point2Mat (__current_s);
const CvMat* A0 = __texture.GetMe an();
SetAllParamsZer o();
__shape.CalcPar ams(__current_s , __search_pq);
IplImage* Drawimg = 0;
char filename[100];

if(showprocess) {
Drawimg = cvCreateImage(c vGetSize(image) , image->depth,
image->nChannels);
mkdir("result") ;
cvCopy(image, Drawimg);
Draw(Drawimg, 2);
sprintf(filenam e, "result/Init.jpg");
cvSaveImage(fil ename, Drawimg);
}

for(int iter = 0; iter < max_iter; iter++)
{
//check the current shape
if(!AAM_IC::IsS hapeWithinImage (__current_s, image->width, image->height)){
fprintf(stderr, "ERROR(%s, %d): Shape out of image\n",
__FILE__, __LINE__);
return iter;
}

//warp image to template image A0
__paw.FasterGet WarpTextureFrom MatShape(__curr ent_s, image, __warp_t,
true);
AAM_TDM::AlignT extureToRef(A0, __warp_t);

//calculate error image
cvSub(__warp_t, A0, __error_t);

if(showprocess) {
cvCopy(image, Drawimg);
Draw(Drawimg, 2);
sprintf(filenam e, "result/Iter-%02d.jpg", iter+1);
cvSaveImage(fil ename, Drawimg);
}

//check for texture divergence
e2 = cvNorm(__error_ t);
if(e2 < 0.01 || (iter>max_iter/3&&fabs(e2-e1)<0.01*e1)) break;
e1 = e2;

//1. calculate dot product of modified steepest descent images
// with error image
//2. calculate delta q and delta p by multiplying by inverse Hessian.
//In summary: we calculate parameters update
cvGEMM(__error_ t, __G, 1, NULL, 1, __delta_pq, CV_GEMM_B_T);

//apply inverse compositional algorithm to update parameters
InverseCompose( __delta_pq, __current_s, __update_s);
//smooth shape
cvAddWeighted(_ _current_s, 0.4, __update_s, 0.6, 0, __update_s);
//update parameters
__shape.CalcPar ams(__update_s, __search_pq);
//calculate constrained new shape
__shape.CalcSha pe(__search_pq, __update_s);

//check for shape convergence
cvSub(__current _s, __update_s, __delta_s);
if(/*cvNorm(__delta _s)<0.01*/cvNorm(__delta_ s, 0, CV_C) < 0.25) break;
else cvCopy(__update _s, __current_s);
}

Shape.Mat2Point (__current_s);

t = ((double)cvGetT ickCount()-t)/(cvGetTickFrequ ency()*1000.);
printf("AAM IC Fitting time cost %.3f millisec\n", t);

cvReleaseImage( &Drawimg);

return iter;
}
Oct 23 '08 #1
3 3294
The last line is the problematic one:

return iter;
Oct 23 '08 #2
Anna Smidt wrote:
The last line is the problematic one:

return iter;
The iter is declared in "for" statement, so it's scope ends
with the for loop. This is the correct standard behavior.
Previous VC++ versions allowed to use variables declared this way
after the for loop, so this code would compile in those versions.

You have two choices: either move iter outside of the for loop,
or turn on the compiler option to enable the old (non-standard) behavior.

--PA
Oct 23 '08 #3
Thanks very much!
Anna
Oct 23 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4840
by: Saurabh Aggrawal | last post by:
Hi, if (iter->m_name.compare(pstrName) == 0) { // Provide our object. *ppunkItem = iter->m_pUnknown; // Addref our object... iter->m_pUnknown->AddRef(); break; }
9
16221
by: W. Van Hooste | last post by:
Just starting with C, can somebody explain why this does not work or point me in the right direction? I wrote some tools and did some coding but cant seem to get this one. I DID declare my FILE *fp! and still get... isource2.c: In function `getval': isource2.c:5: `FILE' undeclared (first use in this function) Here is my Example project:
5
4139
by: Marc Gustafson | last post by:
This function is executed when a application file is double-clicked to open in a VC++ application. Specifically, this function is enabled by RegisterShellFileTypes () in the application's InitInstance. However, under MFC 7.1 for VC++ .NET 2003, CFrameWnd::OnDDEExecute has a bug that repeatedly generates this error message in the debugger Error: failed to execute DDE command ''.
0
1496
by: Stephanie Doherty | last post by:
Hello World, I am trying to use a _spawnl function like this (and I have included the process.h file): _spawnl(_P_WAIT,iporgfile,iporgfile,NULL); It compiles with the following errors: error C2065: '_P_WAIT' : undeclared identifier
6
9893
by: Peter Rothenbuecher | last post by:
Hello, when I try to compile the following code with g++ -o client client.c #include<sys/socket.h> #include<stdio.h> #include<stdlib.h> #define ADDRESS "mysocket"; #define MAXLEN 200;
10
11810
by: teddarr | last post by:
I am trying to construct a class with several functions and identifiers. The identifier in question is static double AIR which will hold the value of the annual interest rate in the class. I have been getting an error message that I can't seem to get rid of: error C2065: 'AIR' undeclared identifier I have never worked with static identifiers before and I think I'm leaving something out somewhere but I don't know what. Here's the...
2
19874
by: aarthi28 | last post by:
Hi, I have this code that I am trying to compile, but I am getting the following errors 'CoInitializeSecurity': identifier not found 'EOAC_NONE' : undeclared identifier I have pasted the code below // Using_WMI1.cpp : Defines the entry point for the console
5
12541
by: vmagana | last post by:
First of all I would like to indicate that I am a newbie a programming. I am having a problem compiling a sample source code that I downloaded from microsoft. When I try to build the program I get an error that 'STORAGE_PROPERTY_QUERY' undeclared identifier. This structure is defined in the ntddstor.h file and is included. I dont understand why it does not see this structure. OS: Windows XP, Visual C++ 6.0, latest SDK and changed the...
1
2594
by: LuxCkrown | last post by:
Hey everyone, i've been browsing for a fix to my problem 1>c:\documents and settings\user\desktop\judis_repack\judis repack\judis repack\maplestoryserver\inventory.cpp(386) : error C2065: 'amount' : undeclared identifier I've found some solutions but I'm not sure how they pertain to my problem. If possible, would there be any general methods of resolving such undeclared identifier problems? This is the string, I'm a complete beginner so i'm...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10242
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.