Copy RGB image pixel value to another white background

10 ビュー (過去 30 日間)
Malan Jayanka
Malan Jayanka 2016 年 7 月 10 日
コメント済み: Malan Jayanka 2016 年 7 月 24 日
I have an image with dimension 785*1300. I want to convert this image to 1300*1300. Here I created a 1300*1300 white image and i want to copy previous image into this image. How can I do this with matlab.

採用された回答

Image Analyst
Image Analyst 2016 年 7 月 10 日
For your specific case here, you can simply use padarray() to pad white on the right and left sides. See the help. Let me know if you can't figure it out, otherwise you can Accept this answer.
  4 件のコメント
Image Analyst
Image Analyst 2016 年 7 月 17 日
編集済み: Image Analyst 2016 年 7 月 17 日
Yes, that should work. Doesn't it? This works fine for me:
colorImage = imread('peppers.png');
subplot(1, 2, 1);
imshow(colorImage);
padding = 100;
paddedImage = padarray(colorImage, [0, padding], 255);
subplot(1, 2, 2);
imshow(paddedImage);
Malan Jayanka
Malan Jayanka 2016 年 7 月 24 日
Thank you sir, It was worked. If I got any doubt I will ask from you sir Thankz a lot sir again

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2016 年 7 月 10 日
Just copy and paste. See my attached demo.
  5 件のコメント
Malan Jayanka
Malan Jayanka 2016 年 7 月 12 日
Could you please explain this more.. image2(row1:row2, col1:col2, :) = image1;
Image Analyst
Image Analyst 2016 年 7 月 12 日
The parts of image2 going from row1 to row2, and from column 1 to column 2 will be replaced by image1.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by