Error on my matrix

8 ビュー (過去 30 日間)
Dogukan Ucak
Dogukan Ucak 2021 年 4 月 8 日
回答済み: madhan ravi 2021 年 4 月 8 日
tw=imread('twins.tif');
t=rgb2gray(tw);
t_sp=imnoise(t,'salt & pepper');
imnoise(t,'salt & pepper',0.2);
t_ga=imnoise(t,'gaussian');
t_spk=imnoise(t,'speckle');
s=size(t);
[x,y]=meshgrid(1:s(1),1:s(2));
p=sin(x/3+y/5)+1;
t_pn=(im2double(t)+p/2)/2;
the error message is
Matrix dimensions must agree.
Error in a (line 10)
t_pn=(im2double(t)+p/2)/2;

回答 (1 件)

madhan ravi
madhan ravi 2021 年 4 月 8 日
t_pn = (im2double(t) + p.' / 2) / 2;

カテゴリ

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by