|
thanks for your reminder. this is actual code. i would like to get nColumnCounts4,nColumnCounts5. is this code right? however i just can get same big value. couldn't get what i want. where is problem, thanks.
nColumnCounts1,nColumnCounts2,and nColumnCounts3 are all right, i checked already.
int a = _iBoundheight%3;
for(iY=0;iY<(a+(static_cast<int>(_iBoundheight/3)));iY++)
{
for (iX=_iBoundx;iX<_iBoundwidth;iX++)
{
if (ImgArray[iX+iY*_iBoundwidth] == 255)
{
nColumnCounts1[iX]++;
}
}
}
for(iY=(a+(static_cast<int>(_iBoundheight/3)));iY<(a+2*(static_cast<int>(_iBoundheight/3)));iY++)
{
for(iX=_iBoundx; iX<_iBoundwidth; iX++)
{
if (ImgArray[iX+iY*_iBoundwidth] == 255)
{
nColumnCounts2[iX]++;
}
}
}
for(iY=(a+2*(static_cast<int>(_iBoundheight/3)));iY<_iBoundheight;iY++)
{
for(iX=_iBoundx; iX<_iBoundwidth; iX++)
{
if (ImgArray[iX+iY*_iBoundwidth] == 255)
{
nColumnCounts3[iX]++;
}
}
}
int a1,a2,a4,a5,s1,s2,s3,r1,r2,r3,av1,av2;
a4=a5=0;
s1=s2=0;
r1=r2=0;
av1=av2=0;
for (int m=0;m<_iBoundwidth;m++)
{
nColumnCounts4[m]=abs(nColumnCounts1[m]-nColumnCounts2[m]);
nColumnCounts5[m]=abs(nColumnCounts2[m]-nColumnCounts3[m]);
a4=a4+nColumnCounts4[m];
a5=a5+nColumnCounts5[m];
}
av1=a4/_iBoundwidth;
av2=a5/_iBoundwidth;
for (int m2=0;m2<_iBoundwidth;m2++)
{
s1=s1+pow(nColumnCounts4[m2]-av1,2.0);
s2=s2+pow(nColumnCounts5[m2]-av2,2.0);
}
_fFeature[0] = sqrt(s1/_iBoundwidth);
_fFeature[1] = sqrt(s2/_iBoundwidth);
delete[] ImgArray;
delete[] nColumnCounts1;
delete[] nColumnCounts2;
delete[] nColumnCounts3;
delete[] nColumnCounts;
delete[] nColumnCounts4;
delete[] nColumnCounts5;
return true;
}
gentleguy
|
|
|
|
|
gentleguy wrote: av1=a4/_iBoundwidth;
av2=a5/_iBoundwidth;
av1, av2 should be declared double (or float ).
Then change the above expression to:
av1 = (double)a4 / _iBoundwidth;
av2 = (double)a5 / _iBoundwidth;
gentleguy wrote: s1=s1+pow(nColumnCounts4[m2]-av1,2.0);
s2=s2+pow(nColumnCounts5[m2]-av2,2.0);
Again, s1, s2 should be declared double .
Those declarations will fix the (otherwise wrong) above expression .
BTW: Are you aware that all that static_cast s you're using are useless (and contributes to overall code entropy)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks
however i couldn't get nColumnCOunts4,5 arrays value. what is problem. i corrected as per your remind.thanks a lot.
int *nColumnCounts = new int[_iBoundwidth];
int *nColumnCounts1 = new int[_iBoundwidth];
int *nColumnCounts2 = new int[_iBoundwidth];
int *nColumnCounts3 = new int[_iBoundwidth];
int *nColumnCounts4 = new int[_iBoundwidth];
int *nColumnCounts5 = new int[_iBoundwidth];
for (int i=0;i<_iBoundwidth;i++)
{
nColumnCounts1[i]=0;
nColumnCounts2[i]=0;
nColumnCounts3[i]=0;
nColumnCounts4[i]=0;
nColumnCounts5[i]=0;
nColumnCounts[i]=0;
}
int a = _iBoundheight%3;
gentleguy
|
|
|
|
|
Please re-format your code.
[added]
actually you did follow NONE of my advices (as can be seen in posted code).
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, July 17, 2008 3:09 AM
|
|
|
|
|
Dear All,
I want to use the BCN_HOTITEMCHANGE event for a button. I included the event using the properties of class for a button, but the event is not triggered when the mouse enter or leave from the button. Please help me. The code snippet is as follows :
void TestDlg::OnBnHotItemChangeButton4(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMBCHOTITEM pHotItem = reinterpret_cast<LPNMBCHOTITEM>(pNMHDR);
m_button4.GetClientRect(&rect);
if(pHotItem->dwFlags==HICF_ENTERING)
{
MessageBox("Mouse entered");
}
else if(pHotItem->dwFlags==HICF_LEAVING)
{
MessageBox("Mouse leaved");
}
else{}
*pResult = 0;
}
|
|
|
|
|
To start with it, have you checked the "Remarks" section for this notification in the documentation page[^]?
|
|
|
|
|
Yes I included the line
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") and I am using VS2005 so that I dont change the manifest file. Eventhough the event is not working. Please advice.
P.S. Please tell me whether to add the ComCtl32.lib or not.
|
|
|
|
|
Naveen has answered (and closed) your query.
|
|
|
|
|
I think the checking should be modified as follows
if(HICF_ENTERING == (pHotItem->dwFlags&HICF_ENTERING))
{
MessageBox("Mouse entered");
}
else if(HICF_LEAVING == (pHotItem->dwFlags&HICF_LEAVING))
{
MessageBox("Mouse leaved");
}
|
|
|
|
|
Dear Naveen,
The event handler does not respond to the mouse over and mouse leave event. (I set a breakpoint in the event handler to check this). I think there must be some more things to do. Please advice.
|
|
|
|
|
Please check the below things..
1. _UNICODE is defined in your project settings( project should be unicode )
2. The window have the XP look and feel while running.
3. The entry in the message map is correct.
|
|
|
|
|
Hello Naveen,
Now it is working. Thank you so much for your guidance. The problem is that the UNICODE is not set.
Now another issue, when I set the button as OWNERDRAW the event is not triggered. I want to change the bitmap for the button on both the mouse over and mouse leave events. Please advice.
|
|
|
|
|
I think in that case you have to use the TrackMouseEvent () function.
|
|
|
|
|
Getting Exception in My APP is MSMQ Service is restarted in middle.
Message text: The Queue Manager service has been restarted. The queue handle is stale and should be closed.
Then Application stops peeking message from MessageQueue.
Exception Point EndPeek():
System.Messaging.Message objMsg = objMQ.EndPeek(asyncResult.AsyncResult);
Thanks in Advance
-@SuDhIrKuMaR@-
modified on Wednesday, July 16, 2008 4:22 AM
|
|
|
|
|
Hi there!
I'm a graduated students majored in Pattern Recognition and I've been
working on this GetRenderHwnd for a few days, I was just wondering
that can i or can i not use this to save color images from GE or store
it in a matrix or something like that, so that I can calcualte and
abstract vessels or vehicles, etc, and then add the processed image to
the GE window as a seperate layer. But it comes to me now to be a
completely pointless effort.
So, is there anyone who have done this, or be familiar with this,
please reply RSVP, or contact me in baodongpo@gmail.com, TKS!
Work already done:
1. Using GetRenderHwnd to obtain the image region and add it in my
App;
2. Starting & closing GE by my third party App;
PS: in VC++ 6.0 or visual C++ 2005 environment, C# also acceptable!
TKS again!
modified on Wednesday, July 16, 2008 5:01 AM
|
|
|
|
|
|
Can you please make the font a little bigger; I'm having trouble reading it.
Steve
|
|
|
|
|
My fault, sorry about that!
|
|
|
|
|
Oh! You've been voted down for saying that? You have a real fan Steve.
|
|
|
|
|
Um,okay, cos I'm knew here, and I haven't got used to the rules here...
So, sorry for bothering U and please forgive my rudeness.
|
|
|
|
|
That's fine and welcome to the community.
Hint: You can edit the ugly looking post by clicking on the edit link at the bottom right of the same post.
|
|
|
|
|
Shouting will not help you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sorry, I'm not quite catch U...
|
|
|
|
|
Using a bigger (or bolder) font than usual is called shouting and it's quite noisy.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Um,okay, here is the reason:
Cos I'm knew here, and I haven't got used to the rules here...
So, sorry for bothering. All I want is a little piece of advice.
TKS, though.
best,
Blade
|
|
|
|