开发者

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)));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜