Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

gentleguy

@gentleguy
About
Posts
249
Topics
123
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • save excel file
    G gentleguy

    Dear all how to save an excel file instead of .txt file in c++? anyone has such code or suggestion?thanks a lot

    gentleguy

    C / C++ / MFC c++ tutorial question

  • cannot convert parameter 1 from 'double [5]' to 'double'
    G gentleguy

    dear all after i debug my code, the erros displayed here: cannot convert parameter 1 from 'double [5]' to 'double' how to solve this problem, anyone can give me suggestion. thanks

    gentleguy

    C / C++ / MFC debugging help tutorial

  • dynamic array use?
    G gentleguy

    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]; //whole image
    int *nColumnCounts1 = new int[_iBoundwidth]; //1st part
    int *nColumnCounts2 = new int[_iBoundwidth]; //2nd part
    int *nColumnCounts3 = new int[_iBoundwidth]; //3rd part
    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; // remainder 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]++; } } } // Average 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; // Standard deviation 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

    C / C++ / MFC data-structures question

  • dynamic array use?
    G gentleguy

    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; // remainder

    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\]++;  
    
    		}
    	}		
    }
    
    
    // Average
    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;
    	
    // Standard deviation
    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

    C / C++ / MFC data-structures question

  • dynamic array use?
    G gentleguy

    dear all int * nColumnCounts1 nColumnCounts2 nColumnCounts3 nColumnCounts4 nColumnCounts5 =new int[constant]; the following is dynamic arrays, and nColumnCounts1,nColumnCounts2,nColumnCounts3 were calculated already correctly, now i would like to calculate nColumnCounts4,nColumnCounts5 as per following formular. is this right way? nColumnCounts4[m]=abs(nColumnCounts1[m]-nColumnCounts2[m]); nColumnCounts5[m]=abs(nColumnCounts2[m]-nColumnCounts3[m]); and then i can get new nColumnCounts4,5. however i couldn't correct result. anyone has suggestion to me, thanks a lot

    gentleguy

    C / C++ / MFC data-structures question

  • couldn't debug?
    G gentleguy

    i set one breakpoint already.

    gentleguy

    C / C++ / MFC question debugging help

  • couldn't debug?
    G gentleguy

    thanks, i used release already.do you have another idea, thanks a lot

    gentleguy

    C / C++ / MFC question debugging help

  • couldn't debug?
    G gentleguy

    dear all my question is after i debug, pc showed me: one or more breakpoints can't be set and have been disabled.execution will be stopped at the beginning of the program. how can i solve this problem. thanks a lot.

    gentleguy

    C / C++ / MFC question debugging help

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks a lot, i still get the correct result. but my data format is a little different. the detail is following:

    unsigned char *ucImgdata1 =m_vicImg.ibuff;
    int iWidth1 = m_vicImg.endx-m_vicImg.stx+1;
    int iHeight1 = m_vicImg.endy-m_vicImg.sty+1;
    int iWidthbyte1=m_vicImg.buffwidth;
    int *nColumnCounts=new int[iWidth1];
    for (int i=0;i<iwidth1;i++)
    { nColumnCounts[i]=0;
    }
    for(int iY=0;iY<iheight1;iy++)
    {
    for(int iX=0;iX<iwidth1;ix++)
    {
    if (imgArray [iX+iY*iWidth1] == 255)
    {
    nColumnCounts[iX]++;
    FILE* stream;
    stream=fopen("C:\\TestArray.txt","w");
    fprintf(stream," Array=%d\n",nColumnCounts[iX]);
    fclose(stream);
    }
    }
    }

    could help me? thanks

    gentleguy

    C / C++ / MFC tutorial question

  • how to calculate all columns amount? [modified]
    G gentleguy

    i am not sure for this. i tried many times, still couldn't finish it. do you have any other idea, thanks

    gentleguy

    C / C++ / MFC tutorial question

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks for your help, my data is from binary image, different binary image has different dimension, when i load one 2-D binary image, depend on image size, but i can obtain width and height of image via access image definition. do you understand me? i can declare a 2-D dinamic array.thanks

    unsigned char *ucImgdata1 =m_vicImg.ibuff;
    int iWidth1 = m_vicImg.endx-m_vicImg.stx+1;
    int iHeight1 = m_vicImg.endy-m_vicImg.sty+1;
    int iWidthbyte1=m_vicImg.buffwidth;
    int *nColumnCounts=new int[iWidth1];

    for (int i=0;i<iwidth1;iwidth1;i++)
    {
    	nColumnCounts\[i\]=0;
    }
    for(int iY=0;iY<iheight;iheight1;iy++)
    {
    	for(int iX=0;iX<iwidth1;iwidth1;ix++)
    	{
    		
    		if (imgArray \[iX+iY\*iwidth1\] == 255)          
    		{
    			
    			nColumnCounts\[iX\]++;  
    			
    			FILE\* stream;
    			stream=fopen("C:\\\\TestArray.txt","w");
    			fprintf(stream," Array=%d\\n",nColumnCounts\[iX\]);
    			fclose(stream);
    		}
    	}
    

    but i couldn't get the correct result. i would like to get one array including how many amount of 255 for each column.help me,thanks.

    gentleguy

    modified on Sunday, June 29, 2008 4:53 AM

    C / C++ / MFC tutorial question

  • how to calculate this amount?
    G gentleguy

    i showed my data examlpe in first post of this time, i thought you have seen it already, so that is why i dun meationed any more, i am sorry for that and thanks for your reply.

    gentleguy

    C / C++ / MFC help tutorial question data-structures

  • how to calculate this amount?
    G gentleguy

    i appologize to you for this case, my data is coming from the mostleft bottom corner, and then scan from this row one by one, after that go to lase-second row, also mostleft point.do you understand? sorry for that, friend.thanks a lot

    gentleguy

    C / C++ / MFC help tutorial question data-structures

  • how to calculate this amount?
    G gentleguy

    dear all i am sorry to ask such question again, i tried many time and still couldn't finish it. can anyone help me here? thanks a lot. my problem is below: just example, my real data are so huge 0 0 0 0 0 0 6 6 6 6 0 0 6 0 0 0 6 6 6 6 how to calculate each column amount 6 and then save it into .txt file as a array. thanks a lot.

    gentleguy

    C / C++ / MFC help tutorial question data-structures

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks a lot. here i will explain to you something, when i calculate 255 for each column, i just can start to scan my data(2-D) from left bottom, and then up row by row,do you understand me? thanks a lot, and disturb you a lot.

    gentleguy

    C / C++ / MFC tutorial question

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks a lot. very helpful, how can i save each column amount? thanks, sorry ask many by the way, why you use the third for loop? don't understnad.could you give me any explanation. thanks a lot

    gentleguy

    modified on Thursday, June 26, 2008 7:50 AM

    C / C++ / MFC tutorial question

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks for reply, for me maybe i have 400 or 700 hundrads columns,i load binary image, maybe 300x600 or evern big than this one... i am a newbie, can give me examlpe.thanks

    gentleguy

    C / C++ / MFC tutorial question

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks for your reply,actually i load one image which is binary image, actually the data is 2_D array. this is about my work...not homework, i am doing projection histogram, so i need to collect each column 255 amound. i am not good in c++..learning...so if possible, pls help me. thanks a lot

    gentleguy

    C / C++ / MFC tutorial question

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks for your reply, i am a newbie, could you give me detail or some code, thanks a lot.

    gentleguy

    C / C++ / MFC tutorial question

  • how to calculate all columns amount? [modified]
    G gentleguy

    thanks for your reply, sorry, the format changed there, actually i would like to calculate each column 255 amount, and then save an file: first row displays columns number and second row display amount of 255. however i revised the format,, it is still problem. do you understand me? thanks for your help in advance.

    gentleguy

    C / C++ / MFC tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups