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
Post a Comment