reasonable question:) Thanks:) I now that there is no reason to create images with size more than size of monitor resolution... And i know that I can programmatically capture sections frow wall image and show them on monitor separetly. But as always - i try to find the easiest way:) And why in stand alone application i don't have such problems? Thantks for participation:)
Rassul Yunussov
Posts
-
Problems with creating very big images -
Problems with creating very big imagesI try to use CImage class for making images, but when i try to create very big images, for example 20 000 X 20 000, the method Create fails. I wrote 2 different applications, one - is stand alone application, and another one is COM object. All the functionality of both programs are same. So in stand alone application i can create image with such dimensions, but when i use COM my method fails. Why does it happens? And how can I solve this problem?
-
Memory LeakOk! Thank You very much for participating.
-
Memory LeakWell, i looked in the task manager - when this process is running the momory grows up. Here is code in pre tags
UINT __cdecl CGNTGDALDlg::GNTClassificationFunction( LPVOID pParam )
{
ThreadStruct* pStruct = (ThreadStruct*)pParam;
int n = pStruct->pDlg->m_Image.GetHeight();
int m = pStruct->pDlg->m_Image.GetWidth();
int LineLength = pStruct->pDlg->m_Image.GetPitch();
unsigned char* Bitmap = (unsigned char*)pStruct->pDlg->m_Image.GetBits();
Bitmap+=LineLength*pStruct->Offset;
if(pStruct->pDlg->m_floatingWindowSize==0)
{
__declspec(align(16)) float* pInputs =(float*) _aligned_malloc(pStruct->pDlg->m_poDataset->GetRasterCount()*sizeof(float),16);
for(int i =pStruct->Offset;iEnd;i++)
{
for(int j = abs(LineLength%m),l=0;jpDlg->m_poDataset->GetRasterCount();k++)
{
pInputs[k] = pStruct->pDlg->m_pImageMatrix[k][i][m-l-1];
Norm+=pInputs[k];
}
Norm = sqrt(Norm);
for(int k = 0;kpDlg->m_poDataset->GetRasterCount();k++)
pInputs[k]/=Norm;
EnterCriticalSection(&pStruct->pDlg->m_CriticalSection);
unsigned int value = pStruct->pDlg->m_pGNTNet->Propagate(pInputs,distance,&pNeuron);
LeaveCriticalSection(&pStruct->pDlg->m_CriticalSection);\*(Bitmap-LineLength-j-1) = GetRValue(value);//eto krasnii \*(Bitmap-LineLength-j-2) = GetGValue(value);//eto zelenii \*(Bitmap-LineLength-j-3) = GetBValue(value);//eto sinii } Bitmap+=LineLength; } \_aligned\_free(pInputs); } else { \_\_declspec(align(16)) float\* pInputs =(float\*) \_aligned\_malloc(pStruct->pDlg->m\_floatingWindowSize\*pStruct->pDlg->m\_floatingWindowSize\*pStruct->pDlg->m\_poDataset->GetRasterCount()\*sizeof(float),16); for(int i =pStruct->Offset;iEnd;i++) { if(ipDlg->m\_poDataset->GetRasterYSize()-pStruct->pDlg->m\_floatingWindowSize) for(int j = abs(LineLength%m),l=0;jpDlg->m\_poDataset->GetRasterXSize()-pStruct->pDlg->m\_floatingWindowSize) { double distance; CGNTNeuron\* pNeuron; int ll = 0; double Norm = 0; for(int k = 0;kpDlg->m\_poDataset->GetRasterCount();k++) for(int ii = i;iipDlg->m\_floatingWindowSize;ii++) for(int jj = l;jjpDlg->m\_floatingWindowSize;jj++) { pInputs\[ll++\] = pS
-
Memory LeakI use CImage class for working with bitmaps and noticed memory leak and can't understand the problem. When i'm trying to change the content of bitmap by accessing the bytes - in different cases i see or not see memory leaks, however the code is same! Here is the code:
UINT __cdecl CGNTGDALDlg::GNTClassificationFunction( LPVOID pParam ) { ThreadStruct* pStruct = (ThreadStruct*)pParam; int n = pStruct->pDlg->m_Image.GetHeight(); int m = pStruct->pDlg->m_Image.GetWidth(); int LineLength = pStruct->pDlg->m_Image.GetPitch(); unsigned char* Bitmap = (unsigned char*)pStruct->pDlg->m_Image.GetBits(); Bitmap+=LineLength*pStruct->Offset; if(pStruct->pDlg->m_floatingWindowSize==0) { __declspec(align(16)) float* pInputs =(float*) _aligned_malloc(pStruct->pDlg->m_poDataset->GetRasterCount()*sizeof(float),16); for(int i =pStruct->Offset;iEnd;i++) { for(int j = abs(LineLength%m),l=0;jpDlg->m_poDataset->GetRasterCount();k++) { pInputs[k] = pStruct->pDlg->m_pImageMatrix[k][i][m-l-1]; Norm+=pInputs[k]; } Norm = sqrt(Norm); for(int k = 0;kpDlg->m_poDataset->GetRasterCount();k++) pInputs[k]/=Norm; EnterCriticalSection(&pStruct->pDlg->m_CriticalSection); unsigned int value = pStruct->pDlg->m_pGNTNet->Propagate(pInputs,distance,&pNeuron); LeaveCriticalSection(&pStruct->pDlg->m_CriticalSection); *(Bitmap-LineLength-j-1) = GetRValue(value);//eto krasnii *(Bitmap-LineLength-j-2) = GetGValue(value);//eto zelenii *(Bitmap-LineLength-j-3) = GetBValue(value);//eto sinii } Bitmap+=LineLength; } _aligned_free(pInputs); } else { __declspec(align(16)) float* pInputs =(float*) _aligned_malloc(pStruct->pDlg->m_floatingWindowSize*pStruct->pDlg->m_floatingWindowSize*pStruct->pDlg->m_poDataset->GetRasterCount()*sizeof(float),16); for(int i =pStruct->Offset;iEnd;i++) { if(ipDlg->m_poDataset->GetRasterYSize()-pStruct->pDlg->m_floatingWindowSize) for(int j = abs(LineLength%m),l=0;jpDlg->m_poDataset->GetRasterXSize()-pStruct->pDlg->m_floatingWindowSize) { double distance; CGNTNeuron* pNeuron; int ll = 0; double Norm = 0; for(int k = 0;kpDlg->m_poDataset->GetRasterCount();k++) for(int ii
-
Optimization questionWell, everybody knows that program works with files very slow, so when i worked with windows API functions and MFC i just download whole file in the memory, and using the class CMemFile worked with it as with the stream. Now i want to work with files using iostream classes (ifstream). But i don't know how to do the same. Does any body know the way?
-
ifstream questionThanks a lot!!! Now i want to read the file into the memory and work with this memory like i worke as with file, i think using istream, but i can't make the istream object... Here is my code:
ifstream shapefilef(ShapeFileName.c_str(),ios::binary); shapefilef.seekg(0,ios::end); streampos ps = shapefilef.tellg(); int size = ps.seekpos(); char* data = new char [size]; shapefilef.seekg(0,ios::beg); shapefilef.read(data,size); istream shapefile(data);
Where is the mistake? I can't compile it... Something in constructor. -
ifstream questionDoes anyone know how to get file size, if i work with files using ifstream class?
-
Why my "i" counter doesn't increases?well, shame on me. I found the problem... I was reading the data to the pointer, that i didn't reserved in the memory. So i erased the memory where "i" was stored.
-
Why my "i" counter doesn't increases?The ComunsNuber is 3, but my cycle runs more than 3 times, because the "i" counter doesn't increases!!! I Can send you the solution in archive, give me you e-mail. And You'll see. The solution is on visual studio 2005 professional
-
Why my "i" counter doesn't increases?The ComunsNuber is 3, but my cycle runs more than 3 times, because the "i" counter doesn't increases!!! I Can send you the solution in archive, give me you e-mail. And You'll see. The solution is on visual studio 2005 professional
-
Why my "i" counter doesn't increases?The cycle i made should work for three times, for the first time in the debug the "i" counter increses from zero to 1, as i see on the second time "i" counter doesn't increases!!! But it have to! I can't understand... Here is the code:
for(int i =0;i<ColumnsNumber;i++) { //Reading Column Definition DBFColumn column; dbffile.read(column.FieldName,10); dbffile.read((char*)&column.caPad,sizeof(char)); dbffile.read((char*)&column.cFieldType,sizeof(char)); dbffile.read((char*)&column.lwhere,sizeof(int)); dbffile.read((char*)&column.cFieldLength,sizeof(char)); dbffile.read((char*)&column.cFieldPrecision,sizeof(char)); dbffile.read((char*)&column.caPad3,14); /*for(int j= 0;j -- modified at 2:57 Wednesday 15th February, 2006
-
Linker errorYes, it looks like i don't have a destructor in my cpp file, but i have... I found a way you can check it - in the wizard you can create a new class, but then delete it from the solution, and include it just in stdafx.h. You'll get the same error as I... So my question is - how to include library, without insertig library in the project
-
Linker errorIt is just mistake in forum... Exactly - i got : error LNK2001: unresolved external symbol "public: __thiscall CFooClass::~CFooClass(void)" (??1CFooClass@@QAE@XZ)
-
Linker errorIf i make a library, consists of two files, for example - foo.h, foo.cpp, where i described a class foo: foo.h file:
class foo { ... public: foo(); void method(); }; foo.cpp file: #include "foo.h" foo::foo() { } foo::method() { }
and then i make a new project, copy this files in the project and in file stdafx.h i write next string #include "foo.h" the linker says that can't link... What am i doing wrong? So... I hope i described my problem clearly:) Sorry for my bad english:sigh: -- modified at 1:05 Tuesday 14th February, 2006 -
FormsI got next problem: I have a lot of different forms for completing, for example the form of water investigations, that have a lot of parameters that user must enter, the form of air investigation, that have a lot of another parameters that user must fill in and so on... And number of forms can grow... I don't want to write for each form a specified ASP.NET page, i want to have functionality, that can make it automatically... I think about XML/XSL, that can handle the information of appearance of page, but how to realize it - no idea... Is it trivial problem? Where can i find any example or theory about it?
-
Something interestingWhen i make an empty project on EVC 4.0 and compile it, then copy the application on Pocket PC and try to start it i can't see the command bar with menu... Maybe it beacause of old version of Windows on this pocket?
-
And GAPI againHow to draw text rotated? Not only horizontal or vertical, for example 45 degree... And what about antialiassing?
-
GAPII'm trying to use GAPI with MFC with frame window and child view, but i can't create window on the wall screen... Actually I made it (by typing this in FrameWnd::OnCreate() { lpCreateStruct->cx = GetSystemMetrics(SM_CXSCREEN); lpCreateStruct->cy = GetSystemMetrics(SM_CYSCREEN);}, but when i tap the window with stylus on top or bottom of window i see the sart panel or command bar - i don't want them to appear ... I just want my window be on top... How to make it?
-
Fast DrawingDoes anybody know any library like DirectX on Pocket PC? Is it possible to draw faster than with GDI and with antialiasing?