画像の上に画像を貼り付ける
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
akasa
am 22 Jun. 2021
Kommentiert: akasa
am 22 Jun. 2021
あるフルスクリーンの画像の上にもう一つの画像を貼り付けたいと考えているのです
が、そのような関数はありますでしょうか?
また、貼り付ける画像のサイズや場所を変更できると嬉しいです。
0 Kommentare
Akzeptierte Antwort
Hernia Baby
am 22 Jun. 2021
Bearbeitet: Hernia Baby
am 22 Jun. 2021
基本的に各座標に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);
4 Kommentare
Hernia Baby
am 22 Jun. 2021
Atsushi Uenoさん、代わりにありがとうございます。
おっしゃる通り、基本的なimread, imshow, imwrite関数はデフォルトで使えます。
Step3の上書きはmatlabでの通常の動作になります。
A = zeros(9);
A(3:5,4:6) = 1
0~255云々が画像になるについて
まずは適当な数字を書きます
x = linspace(255,0,12);
x = uint8(x);
I =reshape(x,[3,4])
それを図示します。
imshow(I)
小さいので拡大すると以下のようになります。
imshow(I,'InitialMagnification','fit')
0は黒、255が白というのがわかります。
これがRed, Green, Blueの3セット分入るとRGBカラーで表示されます。
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Display Image finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!