开发者

how to concatenate an image with a matrix horizontally in MATLAB

开发者 https://www.devze.com 2023-02-28 08:47 出处:网络
I have 开发者_运维问答an image img.I want to conactenate it with a matrix of zeros, but horizontally

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

精彩评论

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