finding minimum value in Quanterion matrix

I have a 386x514 quaternion array,in this please tell how to find the minimum value of that matrix

3 件のコメント

Walter Roberson
Walter Roberson 2012 年 12 月 21 日
What does each element look like? Is there a reason you cannot just use min(TheMatrix(:)) ?
FIR
FIR 2012 年 12 月 21 日
My form is 384x512 pure quaternion array with uint8 components
if i use min i get error
Undefined function or method 'min' for input arguments of type 'quaternion'.
Matt J
Matt J 2012 年 12 月 21 日
FIR Commented:
i downloaded [the quaternion] tool box from here
FIR Commented:
Sorry Matt my code [which doesn't work] is
A=imreadq('peppers.png');
T=65;
for i=2:6
for j=2:6
q= A(i-1:i+1,j-1:j+1);
[minsum, minidx] = min( sum(abs(bsxfun(@minus, q(:), q(:).'))) );
qVFM = q(minidx);
V1=an equation
V2=an equation
S=min([V1 V1]);
if S>T
THE CENTRE PIXEL IS REPLACED BY qVFM %%%%3x3 matrix
else
THE CENTRE PIXEL IS not REPLACED BY qVFM%%%%3x3 matrix
end
end
end

サインインしてコメントする。

 採用された回答

Matt J
Matt J 2012 年 12 月 21 日
編集済み: Matt J 2012 年 12 月 21 日

0 投票

BSXFUN isn't overloaded well in the quaternion toolbox that you're using. Here is a workaround
q= convert(A(i-1:i+1,j-1:j+1),'single');
[minsum, minidx] = min( sum(abs( repmat(q(:),1,9)-repmat(q(:).',9,1) ) ));

9 件のコメント

Walter Roberson
Walter Roberson 2012 年 12 月 21 日
Odd, a lot seemed to disappear there. As I know that I had commented that
min( sum(abs(bsxfun(@minus, q(:), q(:).')))
is code that was developed for numeric arrays, not for quanterion arrays, and that we need to be shown the formula that is being implemented by this code so that we can re-examine it with the quanterion toolbox in mind.
Matt J
Matt J 2012 年 12 月 21 日
編集済み: Matt J 2012 年 12 月 21 日
Well, I think you rightly deduced that the desired formula is the same as in FIR's previous post
except that now we know the q_i in each 3x3 block are not scalars, but rather quaternions. My proposed workaround operates on this assumption.
FIR
FIR 2012 年 12 月 22 日
編集済み: Walter Roberson 2012 年 12 月 22 日
Thanks a lot Matt it is working fine,
q= convert(A(i-1:i+1,j-1:j+1),'single');
q gives 3x3 matrix
final question, i have to add 2nd and 8th pixel and divide by 2 from q, please help
Walter Roberson
Walter Roberson 2012 年 12 月 22 日
2nd and 8th pixel, or 2nd and 8th quaternion ?
FIR
FIR 2012 年 12 月 22 日
q gives 3x3 quanterion,in that 3rd and 8th quanterion
sorry for mistake
Matt J
Matt J 2012 年 12 月 22 日
(q(3)+q(8))/2 ?
FIR
FIR 2012 年 12 月 22 日
i have found 4 values using above equation
V1,V2,V3,V4
now i want to apply in code
A=imreadq('peppers.png');
T=65;
for i=2:6
for j=2:6
q= convert(A(i-1:i+1,j-1:j+1),'single');
[minsum, minidx] = min( sum(abs( repmat(q(:),1,9)-repmat(q(:).',9,1) ) ));
S=min([V1 V2 V3 V4]);
if S>T
THE CENTRE PIXEL OF QUANTERION ARRAY IS REPLACED BY minsum
else
THE CENTRE PIXEL IS not REPLACED BY minsum
end
end
end
please help,and original image must be added with noise,please assist
Matt J
Matt J 2012 年 12 月 22 日
Isn't the center pixel A(i,j)? If so, do A(i,j)=whatever.
Walter Roberson
Walter Roberson 2012 年 12 月 22 日
Or, since that would affect the computations as you slid the window, create a second array and set the pixels in it -- as I showed you in one of your previous questions.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSpecialized Messages についてさらに検索

タグ

質問済み:

FIR
2012 年 12 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by