作者william2961 (william2961)
看板MATLAB
標題[問題] fcm對圖片分群運算問題
時間Mon Dec 9 10:58:22 2013
我想對圖片作FCM分群的影像處理如下:
clear;
clc;
data = imread('C:\ori.jpg');
data2= rgb2gray(data);
options = [2;100;1e-5;0];
[center,U,obj_fcn] = fcm(data2, 3, options);
然執行後一直跳
??? Error using ==> mtimes
Integers can only be combined with integers of the same class, or scalar
doubles.
Error in ==> stepfcm at 25
center = mf*data./((ones(size(data, 2), 1)*sum(mf'))'); % new center
Error in ==> fcm at 88
[U, center, obj_fcn(i)] = stepfcm(data, U, cluster_n, expo);
Error in ==> fcm_test at 8
[center,U,obj_fcn] = fcm(data2, 3, options);
去GOOGLE了一下發現這個錯誤是矩陣乘除法問題
但是此程式碼內並沒有相乘相除的運算
不知道是哪裡出了問題
請有使用過的大大給予幫助
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.137.186
推 yichang53:fcm的data輸入好像不是吃整個矩陣的 應該要轉成行向量 12/09 20:17
→ yichang53:應該用reshape將矩陣轉成行向量 在餵給fcm跑 12/09 20:20
→ yichang53:像是data3 = reshape(double(data2),256*256,1); 12/09 20:21
→ yichang53:原始影像矩陣大小假設是256*256 12/09 20:22
謝謝您的幫助,按照您的建議已可使用
※ 編輯: william2961 來自: 140.112.4.194 (12/11 11:54)