画像の上に画像を貼り付ける
24 ビュー (過去 30 日間)
表示 古いコメント
あるフルスクリーンの画像の上にもう一つの画像を貼り付けたいと考えているのです
が、そのような関数はありますでしょうか?
また、貼り付ける画像のサイズや場所を変更できると嬉しいです。
0 件のコメント
採用された回答
Hernia Baby
2021 年 6 月 22 日
編集済み: Hernia Baby
2021 年 6 月 22 日
基本的に各座標に255までの数字をいれているだけなので、座標と範囲が分かれば貼り付け可能です。
貼り付けというより、上書きに近いです。
--------------
■こちら参考にしてみてください。
---------------
…少々、不親切なので例を入れておきます。
画像は愛犬とmatlabのアイコンです。
Step1. 写真を読み込みます
clc,clear,close all;
dog = imread('chacha.jpeg');
icon = imread('matlab_icon.png');
[xe_d,ye_d,~] = size(dog);
[xe_i,ye_i,~] = size(icon);
dog1 = dog;
montage({dog,icon});
Step2. 範囲を決めます(今回は右下に貼り付けます)
xs = xe_d - xe_i;
ys = ye_d - ye_i;
xe = xs + xe_i;
ye = ys + ye_i;
Step3. 上書きします
dog1(xs+1:xe,ys+1:ye,:) = icon;
imshow(dog1);
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!