c++ - How to assign specific row and column range in a matrix -
i want assign specific row , column range in matrix 1 , multipication of matrix original image multiplying image mask. in matlab used following code
texture_mask= zeros(size(d_mask, 1), size(d_mask,2)); texture_mask(troi(1)-troi(3):troi(1)+troi(3),troi(2)-troi(3):troi(2)+troi(3))=1; im= im2double(im).*repmat(texture_mask, [1 1 3]); im= im(troi(1)-troi(3):troi(1)+troi(3),troi(2)-troi(3):troi(2)+troi(3),:);
when try in opencv following code error in multiplication may beacause texture_mask not assigned properly.
mat texture_mask= mat::zeros((dress_mask.rows),(dress_mask.cols),cv_64fc3); texture_mask.rowrange(troi[0]-troi[2],troi[0]+troi[2]).colrange(troi[1]-troi[2],troi[1]+troi[2])=1; img.convertto(img,cv_64fc3); img= img*texture_mask;//getting error here img=img.rowrange(troi[0]-troi[2],troi[0]+troi[2]).colrange(troi[1]-troi[2],troi[1]+troi[2]);
after doing multiplication have crop image.as shown above.what wrong code??
Comments
Post a Comment