Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int suma=0;
- CImg<unsigned char> image(argv[1]);
- CImg<unsigned char> visu(image.width(),image.height(),1,3,0);
- int tablica[image.width()][image.height()];
- for(int i=0;i<image.width();i++)
- {
- for(int j=0;j<image.height();j++)
- tablica[i][j]=0;
- }
- int n=image.height()*image.width();
- int tmp=0;
- int xd,yd;
- cout<<endl<<"Enter x value of your seed";
- cin>>xd;
- cout<<"Enter y value of your seed ";
- cin>>yd;
- int sred=image(xd,yd,0);
- float kolor;
- do
- {
- cout<<endl<<"In what color I should create region?"<<endl;
- cin>>kolor;
- }while(kolor>255&&kolor<0);
- WHOLE_IMAGE_WITHOUT_BORDERS
- {
- if(image(x,y,z)<(sred+20) && image(x,y,z)>(sred-20))
- {tablica[x][y]=1;}
- }
- tablica[xd][yd]=2;
- for(int m;m<image.height();m++)
- {
- for(int z=0;z<image.width();z++)
- {
- for(int k=0;k<image.height();k++)
- {
- for(int i=-1;i<2;i++)for(int j=-1;j<2;j++)
- {
- if(tablica[k][z]==1){if(tablica[k+i][z+j]==2){tablica[k][z]=2;}}
- }
- }
- }
- }
- for(int x=0;x<image.width();x++)
- {
- for(int y=0;y<image.height();y++)
- { for(int z=0;z<spectrum;z++){
- if(tablica[x][y]==2) {image(x,y,z)=kolor; visu(x,y,z)=60;}
- }}}
- CImgDisplay obrazek(visu,"Click a point");
- CImgDisplay obrazek2(image,"Click a point");
- system("PAUSE");
Add Comment
Please, Sign In to add comment