- #include <cv.h> 
- #include <highgui.h> 
- #include <math.h> 
-   
- int main(int argc, char** argv) { 
-     CvScalar s0 = cvScalarAll(0); 
-     CvScalar s1 = cvScalarAll(255); 
-     IplImage *A = cvLoadImage(argv[1],1); 
-   
-     for(int i=0;i<A->width;i++) 
-         for(int j=0;j<A->height;j++) { 
-             if ( (cvGet2D(A,j,i)).val[0] < 180 ) 
-                 cvSet2D(A,j,i,s0); 
-             else 
-                 cvSet2D(A,j,i,s1); 
-         } 
-     cvNamedWindow("ventana",0); 
-     cvShowImage("ventana",A); 
-     cvWaitKey(0); 
-     cvDestroyAllWindows(); 
-     cvReleaseImage(&A); 
-     return 0; 
- } 
-   
-