c++ - assign white color with .at() not work -


i wrote algorithm future erosion implementation. i'm testing algorithm i've got problem:

when try color pixel white colour image column black , white, otherwise if set each pixel black worked. how can solve?

here's code

mat morph_op_manager::erode_img(mat image) {  //stucture element attribute  int strel_rows = 5; int strel_cols = 5;  // center structure element attribute int cr = 3; int cc = 3;  //number of columns/rows after strel center int nrac = strel_rows - cr ; int ncac = strel_cols - cr ;   int min_val = 255;    (int = cr-1 ; <image.rows-nrac ; i++) {     (int j = cc-1; j < image.cols-ncac ; j++) {          (int ii = 0; ii <strel_rows ; ii++) {             (int jj = 0; jj <strel_cols ; jj++) {                  image.at<int>(i-(nrac-ii),j-(ncac-jj)) = 255;            }         }     } } 

i'm working opencv in c++, file black , white image .tiff. here's output

i don't see how declared image object bet of type cv_8u.

when access pixels should write image.at<uchar>((i-(nrac-ii),j-(ncac-jj)) instead of image.at<int>((i-(nrac-ii),j-(ncac-jj)). that's because declared data in matrix uchar (cv_8u) , not int (cv_32s).


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -