[問題] fcm對圖片分群運算問題

看板MATLAB作者 (william2961)時間10年前 (2013/12/09 10:58), 編輯推噓1(103)
留言4則, 1人參與, 最新討論串1/1
我想對圖片作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

12/09 20:17, , 1F
fcm的data輸入好像不是吃整個矩陣的 應該要轉成行向量
12/09 20:17, 1F

12/09 20:20, , 2F
應該用reshape將矩陣轉成行向量 在餵給fcm跑
12/09 20:20, 2F

12/09 20:21, , 3F
像是data3 = reshape(double(data2),256*256,1);
12/09 20:21, 3F

12/09 20:22, , 4F
原始影像矩陣大小假設是256*256
12/09 20:22, 4F
謝謝您的幫助,按照您的建議已可使用 ※ 編輯: william2961 來自: 140.112.4.194 (12/11 11:54)
文章代碼(AID): #1IfJ7GYp (MATLAB)