After reading the image image processing --- "if read successful" Several tips

"Image Processing --- After reading the image" is read in success "several tips"

  After the image is read to determine whether the reading is successful, the program debugging would certainly help.  

  Use environment VS2010 + OPenCV2.4.3

@ Way:
 // load image 
Mat imread the src = ( " D: \\ \\ stripe003.png 003_test_img " );
 IF (src.empty ()) 
{ 
    the printf ( " Could Not Load Image ... \ n- " );
     return - . 1 ;         // return a successful completion of this function is 0; return -1 failure to complete this function 
}

 

// Second way:
 // load image 
Mat the src; 
the src = imread ( " D: \\ \\ test001.png 003_test_img " );
 IF (! Src.data) 
{ 
  the printf ( " Could Not Load Image ... \ n- " );
  return - . 1 ;    // return a successful completion of this function is 0; return -1 failure to complete this function 
}

 

Guess you like

Origin www.cnblogs.com/carle-09/p/11027563.html
Recommended