cellの場合の書き方がわかりません
Show older comments
1枚の画像について処理してきたコードを複数枚の画像用に書き直したいです。
画像1枚に対するコード(Xのクラス double)
[row, col] = find(BW); %二値化画像から座標取得
X = [row, col];
X = X'; % 転置
X = X - mean(X,2); % 平均値を中央へシフト
[U,S,V] = svd(X); % SVD
[m, n] = size(X);
S2 = S(1:m,1:m); % 固有値
Values = S2^2/n; % 固有値
Vectors = U; % 固有ベクトル
Amplitudes = S*conj(V'); % 直交振幅の計算
idx = abs(Amplitudes(1,:)) <= 150; % 第一主軸150のバラツキを許容
Amp1 = Amplitudes(1,idx); % 150 内の横軸
Amp2 = Amplitudes(2,idx); % 150 内の縦軸
Amp2Max = max(Amp2); % 縦軸上の最大値
Amp2Min = min(Amp2); % 縦軸上の最小値
DAmp2 = Amp2Max - Amp2Min; % 最大 - 最小
複数枚画像に対するコード(Xのクラス cell)
[row, col] = cellfun(@(x) find(x),BWs,'uni',false); %二値化画像群から座標取得
X = [row, col];
X = X'; % 転置
X = cellfun(@(x) x - mean(x,2),X,'uni',false); %平均を中央値へシフト
[U,S,V] = cellfun(@(x) svd(x),X,'uni',false); % SVD
[m, n] = cellfun(@(x) size(x),X,'uni',false);
コードが長くなってしまい申し訳ありません。
途中までは動いたのですが、ここから書き方が分かりません。
ご教授いただきたく存じます。
Accepted Answer
More Answers (0)
Categories
Find more on イメージ 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!