2枚の画像に対してブ​ロックごとにSSIM​を出したい

6 views (last 30 days)
和神 水ノ江
和神 水ノ江 on 4 Aug 2021
2枚の入力画像(300×300)に対し、10×10のブロックごとにSSIMを出し、入力画像のどこのブロックに差があるのかを出力したいと考えています。
画像に対するブロックごとの処理ということでblockprocを用いて行おうとしましたが、入力が2つあるため上手く実装することができませんでした。
この場合、どのように実装すればよろしいでしょうか?

Accepted Answer

Atsushi Ueno
Atsushi Ueno on 4 Aug 2021
2枚のデータ(2次元)を3次元方向に重ねれば、まとめてblockproc関数に渡す事が出来ます。
star = rgb2gray(imread('star.png'));
circle = rgb2gray(imread('circle.png'));
stacks = cat(3,star,circle); % 2枚の入力画像を1変数に重ねる
fun = @(block_struct) ssim(block_struct.data(:,:,1),block_struct.data(:,:,2));
ssimvals = blockproc(stacks,[10 10],fun); % 10×10のブロックごとにSSIMを出す
imshow(ssimvals); % 30×30のSSIM値を試しに画像として表示してみる
検証用に準備した2枚の入力画像(300×300)は、適当な絵(〇と☆)で類似性は全くありません。
  1 Comment
和神 水ノ江
和神 水ノ江 on 5 Aug 2021
想定している実装ができました。
ありがとうございました。

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!