fork download
  1.  
  2.  
  3. #include <opencv\highgui.h>
  4. #include "opencv2/imgproc/imgproc.hpp"
  5. #include <opencv\cvaux.h>
  6. #include <opencv\cxcore.h>
  7. #include <opencv\cv.h>
  8.  
  9.  
  10.  
  11. Mat image=imread("xx.jpg");
  12. Mat I(Size(image.size().width,image.size().height),CV_8UC3);
  13.  
  14. Scalar intensity;
  15. vector<Mat> channel;
  16.  
  17. split(I,channel);
  18.  
  19. for(int i=0;i<image.rows;i++){
  20. for(int j=0;j<image.cols;j++){
  21. intensity.val[0]=image.at<Vec3b>(i,j)[0];//R
  22. intensity.val[1]=image.at<Vec3b>(i,j)[1];//G
  23. intensity.val[2]=image.at<Vec3b>(i,j)[2];//B
  24. channel[2].at<uchar>(i,j)=(2*intensity.val[1]-intensity.val[0]-0.5*intensity.val[2])/4.;
  25. channel[0].at<uchar>(i,j)=acos(0.5*((intensity.val[0]-intensity.val[1])+(intensity.val[0]-intensity.val[2])/sqrt((intensity.val[0]-intensity.val[1])*(intensity.val[0]-intensity.val[1])+(intensity.val[0]-intensity.val[2])*(intensity.val[1]-intensity.val[2]))));
  26. channel[1].at<uchar>(i,j)=channel[2].at<uchar>(i,j)-(3*Min(intensity.val[0],intensity.val[1],intensity.val[2]))/(intensity.val[0]+intensity.val[1]+intensity.val[2]);
  27.  
  28. }
  29. }
  30.  
  31. merge(channel,I);
  32. imshow("XXX",I);
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:28: error: opencv\highgui.h: No such file or directory
prog.cpp:4:39: error: opencv2/imgproc/imgproc.hpp: No such file or directory
prog.cpp:5:26: error: opencv\cvaux.h: No such file or directory
prog.cpp:6:27: error: opencv\cxcore.h: No such file or directory
prog.cpp:7:23: error: opencv\cv.h: No such file or directory
prog.cpp:11: error: ‘Mat’ does not name a type
prog.cpp:12: error: ‘Mat’ does not name a type
prog.cpp:14: error: ‘Scalar’ does not name a type
prog.cpp:15: error: expected constructor, destructor, or type conversion before ‘<’ token
prog.cpp:17: error: expected constructor, destructor, or type conversion before ‘(’ token
prog.cpp:19: error: expected unqualified-id before ‘for’
prog.cpp:19: error: expected constructor, destructor, or type conversion before ‘<’ token
prog.cpp:19: error: expected constructor, destructor, or type conversion before ‘++’ token
stdout
Standard output is empty