Custom Search

Wednesday, February 24, 2010

opencv read xml file contents

I spent 1 hour trying to find out what was the problem of reading the contents of an xml file.

When reading a single parameter,

eg. 0

you have to use cvReadIntByName

When reading multiple parameters

eg. 0 30 200 10 3

you have to use CvSeq* s = cvGetFileNodeByName(fs,0,"calibration")->data.seq;

then cvReadInt( (CvFileNode*)cvGetSeqElem(s,index) );

My problem was I was reading a single parameter and I used the second method but specifying index = 0. This doesn't work! CvSeq* s returns rubbish when there is only 1 parameter.


Thursday, February 11, 2010

Create EXE from SWF

Create a new project Flex project
Application Type web application (not Desktop Application which becomes *.air)

In your Flex SDK folders you should see a 'runtimes\player\win\FlashPlayer.exe' which is a stand alone Flash player. Open your SWF with that and you'll see a 'Create Projector...' menu item in the File menu which will create the stand-alone EXE.


Tuesday, February 9, 2010

Get MAC Address

#include
#pragma comment(lib, "IPHLPAPI.lib")


static void GetMACaddress(void)
{
IP_ADAPTER_INFO AdapterInfo[16];
DWORD dwBufLen = sizeof(AdapterInfo);
DWORD dwStatus = GetAdaptersInfo(AdapterInfo,&dwBufLen);
assert(dwStatus == ERROR_SUCCESS);
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
char macaddress[13];
char tempmacaddress[3];
do{
sprintf(macaddress,"");
printf("%s",pAdapterInfo->AdapterName);
for(int i=0; iAddressLength;i++)
{
if(i== (pAdapterInfo->AddressLength -1))
{
sprintf(tempmacaddress,"%.2X",(int)pAdapterInfo->Address[i]);
strcat(macaddress, tempmacaddress);
//printf("%.2X\n",(int)pAdapterInfo->Address[i]);
}else{
sprintf(tempmacaddress,"%.2X",(int)pAdapterInfo->Address[i]);
strcat(macaddress, tempmacaddress);
//printf("%.2X-",(int)pAdapterInfo->Address[i]);
}
}
printf(macaddress);
pAdapterInfo = pAdapterInfo->Next;
}while(pAdapterInfo);
}