समस्या यह है कि frdescp
कोड (मैंने this code का उपयोग किया था, जो आपके द्वारा संदर्भित जैसा ही होना चाहिए) फूरियर डिस्क्रिप्टर को केन्द्रित करने के लिए भी लिखा गया है।
यदि आप सही तरीके से अपने आकार का वर्णन करना चाहते हैं, तो डीसी घटक का प्रतिनिधित्व करने वाले व्यक्ति के संबंध में सममित होने वाले कुछ वर्णनकर्ताओं को समझना अनिवार्य है।
निम्न छवि अवधारणा को संक्षेप में:
आपकी समस्या (और आपके जैसे अन्य) हल करने के लिए, मैं निम्नलिखित दो कार्यों लिखा है:
function descriptors = fourierdescriptor(boundary)
%I assume that the boundary is a N x 2 matrix
%Also, N must be an even number
np = size(boundary, 1);
s = boundary(:, 1) + i*boundary(:, 2);
descriptors = fft(s);
descriptors = [descriptors((1+(np/2)):end); descriptors(1:np/2)];
end
function significativedescriptors = getsignificativedescriptors(alldescriptors, num)
%num is the number of significative descriptors (in your example, is was 20)
%In the following, I assume that num and size(alldescriptors,1) are even numbers
dim = size(alldescriptors, 1);
if num >= dim
significativedescriptors = alldescriptors;
else
a = (dim/2 - num/2) + 1;
b = dim/2 + num/2;
significativedescriptors = alldescriptors(a : b);
end
end
पता है, तुम उपर्युक्त कार्यों का उपयोग निम्नानुसार कर सकते हैं:
im = imread('test.jpg');
im = im2bw(im);
b = bwboundaries(im);
b = b{1};
%force the number of boundary points to be even
if mod(size(b,1), 2) ~= 0
b = [b; b(end, :)];
end
%define the number of significative descriptors I want to extract (it must be even)
numdescr = 20;
%Now, you can extract all fourier descriptors...
f = fourierdescriptor(b);
%...and get only the most significative:
f_sign = getsignificativedescriptors(f, numdescr);
स्रोत
2014-05-19 15:01:40
आप कहाँ से frdescp प्राप्त किया? यह समस्या का स्रोत हो सकता है – Rasman
मुझे इसे MATLAB पुस्तक का उपयोग करके गोंज़ालेज की डिजिटल छवि प्रसंस्करण से मिला, वास्तव में मुझे लगता है कि bwboundaries समस्या है! –
मैंने संपादित किया [मेरा पिछला उत्तर] (http://stackoverflow.com/a/23741097/738017), मुझे आशा है कि यह आपके और अन्य उपयोगकर्ताओं के लिए उपयोगी हो सकता है। –