トリミングした部分を​別の背景に元画像と同​じ座標に張り付けたい

3 views (last 30 days)
takai
takai on 18 Dec 2023
Answered: COVAO on 13 Jan 2024
コンクリートの床版画像を細かく分割して、分割したすべての画像をセマンティックセグメンテーションを用いてひび割れ部分を抽出するAIモデルにかけ、ひび割れ部分を抽出する。その後にひび割れ部分に色がついている分割された画像を黒の背景画像に元画像を同じ座標に張りつけて1枚の「ひび割れ部分(色付きの線)」「ひび割れがない部分(黒)」になっている画像を作成したい。AIモデルと元画像を分割しトリミングするところまでのスクリプトは完成しているが、トリミングした分割画像を黒背景に元の座標に張り付ける関数、スクリプトが分からないので教えてほしいです。

Answers (1)

COVAO
COVAO on 13 Jan 2024
イメージデータの透明度AlphaDataを設定すると、画像を重ねて表示することができます。
下記に例があります。
MATLAB標準関数で、透明度を設定した画像表示の例です。
earth = imread('landOcean.jpg');
image(earth)
axis image
clouds = imread('cloudCombined.jpg');
image(clouds);
image(earth);
axis image;
hold on;
im = image(clouds);
alpha = 255*uint8( (clouds(:,:,1)+clouds(:,:,2)+clouds(:,:,3))/3 > 50 ); %Caluculate alpha data
im.AlphaData = alpha;
hold off;

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!