Guest User

Untitled

a guest
May 26th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. int suma=0;
  2. CImg<unsigned char> image(argv[1]);
  3. CImg<unsigned char> visu(image.width(),image.height(),1,3,0);
  4. int tablica[image.width()][image.height()];
  5. for(int i=0;i<image.width();i++)
  6. {
  7. for(int j=0;j<image.height();j++)
  8. tablica[i][j]=0;
  9. }
  10. int n=image.height()*image.width();
  11. int tmp=0;
  12.  
  13.  
  14.  
  15.  
  16.  
  17. int xd,yd;
  18. cout<<endl<<"Enter x value of your seed";
  19. cin>>xd;
  20. cout<<"Enter y value of your seed ";
  21. cin>>yd;
  22. int sred=image(xd,yd,0);
  23.  
  24. float kolor;
  25. do
  26. {
  27. cout<<endl<<"In what color I should create region?"<<endl;
  28. cin>>kolor;
  29. }while(kolor>255&&kolor<0);
  30.  
  31. WHOLE_IMAGE_WITHOUT_BORDERS
  32. {
  33. if(image(x,y,z)<(sred+20) && image(x,y,z)>(sred-20))
  34. {tablica[x][y]=1;}
  35. }
  36. tablica[xd][yd]=2;
  37.  
  38.  
  39. for(int m;m<image.height();m++)
  40. {
  41.  
  42. for(int z=0;z<image.width();z++)
  43. {
  44.  
  45. for(int k=0;k<image.height();k++)
  46. {
  47. for(int i=-1;i<2;i++)for(int j=-1;j<2;j++)
  48. {
  49. if(tablica[k][z]==1){if(tablica[k+i][z+j]==2){tablica[k][z]=2;}}
  50. }
  51. }
  52. }
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59. for(int x=0;x<image.width();x++)
  60. {
  61.  
  62. for(int y=0;y<image.height();y++)
  63. { for(int z=0;z<spectrum;z++){
  64. if(tablica[x][y]==2) {image(x,y,z)=kolor; visu(x,y,z)=60;}
  65. }}}
  66.  
  67.  
  68.  
  69.  
  70.  
  71. CImgDisplay obrazek(visu,"Click a point");
  72. CImgDisplay obrazek2(image,"Click a point");
  73. system("PAUSE");
Add Comment
Please, Sign In to add comment