fork download
  1. void saleicy_tr1()
  2. {
  3. Mat source_1 = imread("/media/BACC8094CC804C97/UAS-DTU/Pics/suas 2012/tmp12/IMG_3226");//
  4. if(!source_1.data)
  5. {
  6. cout<<"File not found";
  7. return;
  8. }
  9. Mat source_image = Mat(source_1.size(), CV_32FC3);
  10. source_1.convertTo(source_image, CV_32FC3);
  11. Mat source_gray = Mat(source_image.size(), CV_32FC1);
  12.  
  13. cvtColor(source_image, source_gray, CV_BGR2GRAY);
  14. Mat down_1 ;//= Mat(source_gray.cols/2, source_gray.rows/2, CV_32FC1);
  15. Mat down_2 ;//= Mat(down_1.cols/2, down_1.rows/2, CV_32FC1);;
  16. Mat down_3 ;
  17. Mat down_4;
  18. Mat down_5;
  19. Mat down_6;
  20. Mat down_7;
  21. Mat down_8;
  22. //= Mat(down_2.cols/2, down_2.rows/2, CV_32FC1);;
  23. pyrDown(source_gray, down_1);
  24. pyrDown(down_1, down_2);
  25. pyrDown(down_2, down_3);
  26. pyrDown(down_3, down_4);
  27. pyrDown(down_4, down_5);
  28. pyrDown(down_5, down_6);
  29. pyrDown(down_6, down_7);
  30. pyrDown(down_7, down_8);
  31. Mat up_7;
  32. Mat up_6;
  33. Mat up_5;
  34. Mat up_4;
  35. Mat up_3;
  36. Mat up_1;
  37. Mat up_2;
  38. Mat up_0;
  39. pyrUp(down_8, up_7);
  40. pyrUp(up_7, up_6);
  41. pyrUp(up_6, up_5);
  42. pyrUp(up_5, up_4);
  43. pyrUp(up_4, up_3);
  44. pyrUp(up_3, up_2);
  45. pyrUp(up_2, up_1);
  46. pyrUp(up_1, up_0);
  47. Mat MiR = Mat(up_0.size(), CV_32FC1);
  48. float a,b;
  49. for(int i = 0 ; i<source_gray.rows; i++)
  50. {
  51. for(int j = 0; j<source_gray.cols; ++j)
  52. {
  53. a = up_0.at<float>(i,j);
  54. b = source_gray.at<float>(i,j);
  55. //cout<<a<<" "<<b<<"\n";
  56. if(a<1)
  57. a=1;
  58. if(b<1)
  59. b=1;
  60. if((a/b)<(b/a))
  61. MiR.at<float>(i,j)= (1-( a/b));//*(255.0/0.99);
  62. else
  63. MiR.at<float>(i,j)= (1- (b/a));//*(255.0/0.99);
  64.  
  65.  
  66. }
  67. }
  68.  
  69. double min, max;
  70. minMaxLoc(MiR, &min, &max, NULL, NULL);
  71. Mat s = Mat(MiR.size(), CV_8UC1);
  72. Scalar mean_v = mean(MiR);
  73.  
  74. for(int i = 0 ; i<source_gray.rows; i++)
  75. {
  76. for(int j = 0; j<source_gray.cols; ++j)
  77. {
  78. MiR.at<float>(i,j)= (MiR.at<float>(i,j)-mean_v.val[0])*255/(max-min);//*(255.0/0.99);
  79.  
  80.  
  81. }
  82. }
  83. MiR.convertTo(s, CV_8UC1);
  84.  
  85. namedWindow("A", CV_WINDOW_NORMAL|CV_WINDOW_FREERATIO);
  86. imshow("A", source_gray);
  87. namedWindow("B", CV_WINDOW_NORMAL|CV_WINDOW_FREERATIO);
  88. imshow("B", up_0);
  89. //namedWindow("saliency", CV_WINDOW_NORMAL|CV_WINDOW_FREERATIO);
  90.  
  91. imwrite("saliency.jpg", s);
  92.  
  93. namedWindow("c", CV_WINDOW_NORMAL);
  94. //waitKey(10);
  95. //s.convertTo(s,CV_16UC1,255,255);
  96. //Canny(s,s,30,120,3);
  97. imshow("c", s);
  98. //waitKey(1);
  99. waitKey(0);
  100. s.copyTo(source_gray);
  101.  
  102.  
  103. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void saleicy_tr1()':
prog.cpp:3:2: error: 'Mat' was not declared in this scope
  Mat source_1 = imread("/media/BACC8094CC804C97/UAS-DTU/Pics/suas 2012/tmp12/IMG_3226");//
  ^
prog.cpp:4:6: error: 'source_1' was not declared in this scope
  if(!source_1.data)
      ^
prog.cpp:6:3: error: 'cout' was not declared in this scope
   cout<<"File not found";
   ^
prog.cpp:9:6: error: expected ';' before 'source_image'
  Mat source_image = Mat(source_1.size(), CV_32FC3);
      ^
prog.cpp:10:2: error: 'source_1' was not declared in this scope
  source_1.convertTo(source_image, CV_32FC3);
  ^
prog.cpp:10:21: error: 'source_image' was not declared in this scope
  source_1.convertTo(source_image, CV_32FC3);
                     ^
prog.cpp:10:35: error: 'CV_32FC3' was not declared in this scope
  source_1.convertTo(source_image, CV_32FC3);
                                   ^
prog.cpp:11:6: error: expected ';' before 'source_gray'
  Mat source_gray = Mat(source_image.size(), CV_32FC1);
      ^
prog.cpp:13:25: error: 'source_gray' was not declared in this scope
  cvtColor(source_image, source_gray, CV_BGR2GRAY);
                         ^
prog.cpp:13:38: error: 'CV_BGR2GRAY' was not declared in this scope
  cvtColor(source_image, source_gray, CV_BGR2GRAY);
                                      ^
prog.cpp:13:49: error: 'cvtColor' was not declared in this scope
  cvtColor(source_image, source_gray, CV_BGR2GRAY);
                                                 ^
prog.cpp:14:6: error: expected ';' before 'down_1'
  Mat down_1 ;//= Mat(source_gray.cols/2, source_gray.rows/2, CV_32FC1);
      ^
prog.cpp:15:6: error: expected ';' before 'down_2'
  Mat down_2 ;//= Mat(down_1.cols/2, down_1.rows/2, CV_32FC1);;
      ^
prog.cpp:16:6: error: expected ';' before 'down_3'
  Mat down_3 ;
      ^
prog.cpp:17:6: error: expected ';' before 'down_4'
  Mat down_4;
      ^
prog.cpp:18:6: error: expected ';' before 'down_5'
  Mat down_5;
      ^
prog.cpp:19:6: error: expected ';' before 'down_6'
  Mat down_6;
      ^
prog.cpp:20:6: error: expected ';' before 'down_7'
  Mat down_7;
      ^
prog.cpp:21:6: error: expected ';' before 'down_8'
  Mat down_8;
      ^
prog.cpp:23:23: error: 'down_1' was not declared in this scope
  pyrDown(source_gray, down_1);
                       ^
prog.cpp:23:29: error: 'pyrDown' was not declared in this scope
  pyrDown(source_gray, down_1);
                             ^
prog.cpp:24:18: error: 'down_2' was not declared in this scope
  pyrDown(down_1, down_2);
                  ^
prog.cpp:25:18: error: 'down_3' was not declared in this scope
  pyrDown(down_2, down_3);
                  ^
prog.cpp:26:18: error: 'down_4' was not declared in this scope
  pyrDown(down_3, down_4);
                  ^
prog.cpp:27:18: error: 'down_5' was not declared in this scope
  pyrDown(down_4, down_5);
                  ^
prog.cpp:28:18: error: 'down_6' was not declared in this scope
  pyrDown(down_5, down_6);
                  ^
prog.cpp:29:18: error: 'down_7' was not declared in this scope
  pyrDown(down_6, down_7);
                  ^
prog.cpp:30:18: error: 'down_8' was not declared in this scope
  pyrDown(down_7, down_8);
                  ^
prog.cpp:31:6: error: expected ';' before 'up_7'
  Mat up_7;
      ^
prog.cpp:32:6: error: expected ';' before 'up_6'
  Mat up_6;
      ^
prog.cpp:33:6: error: expected ';' before 'up_5'
  Mat up_5;
      ^
prog.cpp:34:6: error: expected ';' before 'up_4'
  Mat up_4;
      ^
prog.cpp:35:6: error: expected ';' before 'up_3'
  Mat up_3;
      ^
prog.cpp:36:6: error: expected ';' before 'up_1'
  Mat up_1;
      ^
prog.cpp:37:6: error: expected ';' before 'up_2'
  Mat up_2;
      ^
prog.cpp:38:6: error: expected ';' before 'up_0'
  Mat up_0;
      ^
prog.cpp:39:16: error: 'up_7' was not declared in this scope
  pyrUp(down_8, up_7);
                ^
prog.cpp:39:20: error: 'pyrUp' was not declared in this scope
  pyrUp(down_8, up_7);
                    ^
prog.cpp:40:14: error: 'up_6' was not declared in this scope
  pyrUp(up_7, up_6);
              ^
prog.cpp:41:14: error: 'up_5' was not declared in this scope
  pyrUp(up_6, up_5);
              ^
prog.cpp:42:14: error: 'up_4' was not declared in this scope
  pyrUp(up_5, up_4);
              ^
prog.cpp:43:14: error: 'up_3' was not declared in this scope
  pyrUp(up_4, up_3);
              ^
prog.cpp:44:14: error: 'up_2' was not declared in this scope
  pyrUp(up_3, up_2);
              ^
prog.cpp:45:14: error: 'up_1' was not declared in this scope
  pyrUp(up_2, up_1);
              ^
prog.cpp:46:14: error: 'up_0' was not declared in this scope
  pyrUp(up_1, up_0);
              ^
prog.cpp:47:6: error: expected ';' before 'MiR'
  Mat MiR = Mat(up_0.size(), CV_32FC1);
      ^
prog.cpp:53:17: error: expected primary-expression before 'float'
     a = up_0.at<float>(i,j);
                 ^
prog.cpp:54:24: error: expected primary-expression before 'float'
     b = source_gray.at<float>(i,j);
                        ^
prog.cpp:61:6: error: 'MiR' was not declared in this scope
      MiR.at<float>(i,j)= (1-( a/b));//*(255.0/0.99);
      ^
prog.cpp:61:13: error: expected primary-expression before 'float'
      MiR.at<float>(i,j)= (1-( a/b));//*(255.0/0.99);
             ^
prog.cpp:63:6: error: 'MiR' was not declared in this scope
      MiR.at<float>(i,j)= (1- (b/a));//*(255.0/0.99);
      ^
prog.cpp:63:13: error: expected primary-expression before 'float'
      MiR.at<float>(i,j)= (1- (b/a));//*(255.0/0.99);
             ^
prog.cpp:70:12: error: 'MiR' was not declared in this scope
  minMaxLoc(MiR, &min, &max, NULL, NULL);
            ^
prog.cpp:70:29: error: 'NULL' was not declared in this scope
  minMaxLoc(MiR, &min, &max, NULL, NULL);
                             ^
prog.cpp:70:39: error: 'minMaxLoc' was not declared in this scope
  minMaxLoc(MiR, &min, &max, NULL, NULL);
                                       ^
prog.cpp:71:6: error: expected ';' before 's'
  Mat s = Mat(MiR.size(), CV_8UC1);
      ^
prog.cpp:72:2: error: 'Scalar' was not declared in this scope
  Scalar mean_v = mean(MiR);
  ^
prog.cpp:78:13: error: expected primary-expression before 'float'
      MiR.at<float>(i,j)= (MiR.at<float>(i,j)-mean_v.val[0])*255/(max-min);//*(255.0/0.99);
             ^
prog.cpp:83:16: error: 's' was not declared in this scope
  MiR.convertTo(s, CV_8UC1);
                ^
prog.cpp:83:19: error: 'CV_8UC1' was not declared in this scope
  MiR.convertTo(s, CV_8UC1);
                   ^
prog.cpp:85:19: error: 'CV_WINDOW_NORMAL' was not declared in this scope
  namedWindow("A", CV_WINDOW_NORMAL|CV_WINDOW_FREERATIO);
                   ^
prog.cpp:85:36: error: 'CV_WINDOW_FREERATIO' was not declared in this scope
  namedWindow("A", CV_WINDOW_NORMAL|CV_WINDOW_FREERATIO);
                                    ^
prog.cpp:85:55: error: 'namedWindow' was not declared in this scope
  namedWindow("A", CV_WINDOW_NORMAL|CV_WINDOW_FREERATIO);
                                                       ^
prog.cpp:86:25: error: 'imshow' was not declared in this scope
  imshow("A", source_gray);
                         ^
prog.cpp:91:27: error: 'imwrite' was not declared in this scope
  imwrite("saliency.jpg", s);
                           ^
prog.cpp:99:11: error: 'waitKey' was not declared in this scope
  waitKey(0);
           ^
stdout
Standard output is empty