how to concatenate an image with a matrix horizontally in MATLAB
I have 开发者_运维问答an image img
. I want to conactenate it with a matrix of zeros, but horizontally
i-e image should appear with black color.
To get you started, this adds a row of zeros to the bottom of a grayscale image:
result = [img; zeros(1,size(img,2))]
and this does the same to an rgb image:
result = [img; zeros(1,size(img,2),3)]
To add zeros on to the right hand side of an image
newImg=cat(2,img,zeros(size(img,1),numNewColumns,size(img,3)));
精彩评论