#include #include #include #include #include using namespace Magick; class CImage { public: int maxX; int maxY; int cRes; int **intensity; int loadImage(char*); int saveImage(char*); void print(); void showImage(); void DetectB(); void DetectBS(); void LoG(); void HoughTransformLine(int nt,int nc,int n1); void HoughTransformCircle(int nc,int n1); // void HoughTransform(int nt,int nc); CImage() { maxX = maxY = 0; intensity = NULL; cRes = 255; } CImage(int maxx, int maxy) { maxX = maxx; maxY = maxy; intensity = new int*[maxY]; for(int i=0;i=0)&&(j1>=0)&&(i1=0)&&(j1>=0)&&(i1=0) &&(intensity[i+1][j] <0)) ||((intensity[i][j] >=0) &&(intensity[i][j+1] <0))) intensity[i][j] = 255; else intensity[i][j] = 0; for(int i=0;i=0) &&(intensity[i+1][j] <0)) ||((intensity[i][j] >=0) &&(intensity[i][j+1] <0))||((intensity[i][j] <0) &&(intensity[i+1][j] >=0))||((intensity[i][j] <0) &&(intensity[i][j+1] >=0))) intensity[i][j] = 255; else intensity[i][j] = 0; for(int i=0;icRes/2) { for(k=-3.14/2;k<3.14/2;k+=dtheta) { p = j * sin(k) + i * cos(k); p+=maxp; block[(int)(p/(2.0*maxp)*nc)][int((k+1.57)/3.14*nt)]++; } } } bool isline; int maxn = 0; for(i=0;icRes/2) { isline = false; for(k=-3.14/2;k<3.14/2;k+=dtheta) { p = j * sin(k) + i * cos(k); p+=maxp; if( block[(int)(p/2.0/maxp*nc)][int((k+1.57)/3.14*nt)] >= n1) isline = true; } if(isline) intensity[i][j] = cRes; else intensity[i][j] = 0; } else intensity[i][j] = 0; } for(int i=0;iblock[i][j]) ? maxn : block[i][j]; for(int i=0;icRes/2) { for(i1=0;i1cRes/2) { iscircle = false; for(i1=0;i1=n1) // &&((block[int(i1/dx1)][int(j1/dx2)][int(k1/max3*nc)]>k1*3/2*3.14))) { // cout<cRes)||(intensity[i][j]<0)) cout<<"\n\n\nerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrror\n\n\n"; cout<<" "<>option; int div,n1; switch(option) { case 1 : cout<<"\n\nEnter name of image file (JPEG file) : "; cin>>fname; i.loadImage(fname); cout<<"\n\nImage is loaded.\nSize is : "<>fname; i.saveImage(fname); cout<<"\n\nImage is saved.\n"; break; case 4: i.LoG(); break; case 5: cout<<"Enter number of points that must be present in a line : "; cin>>n1; cout<<"Enter the number of divisions in theta-rough plane : "; cin>>div; i.HoughTransformLine(div,div,n1); break; case 6: cout<<"Enter number of points that must be present in a circle : "; cin>>n1; cout<<"Enter the number of divisions in theta-rough plane : "; cin>>div; i.HoughTransformCircle(div,n1); break; case 10: i.print(); break; case 0 : cout<<"\n\n\nProgram made by : \n Ashish Gupta (98130) & \n Ashish Gupta (98131) \n\n\n"; break; default: cout<<"\n\nWrong Option."; } } }