HI to all.. this is about thresholding the image ..
1 回表示 (過去 30 日間)
古いコメントを表示
i am doing with thresholding a image ,i have an image .. for examble
256*256 = 65536 co efficients .. out of that i want to select
65536/4 =16384
with largest absolute values ..
please some body help
採用された回答
Chandra Kurniawan
2012 年 1 月 11 日
Hi,
I have small example for 4x4 matrix.
I = round(10*rand(4,4))
J = zeros(size(I,1), size(I,2));
coeff = numel(I)/4;
[B IX] = sort(I(:),'descend');
J(IX(1:coeff)) = 1
The idea is sort the matrix and then select 4 largest element.
See the result below :
I =
7 8 3 7
1 7 7 5
7 9 2 5
5 9 0 9
J =
0 1 0 0
0 0 0 0
0 1 0 0
0 1 0 1
To apply this to image, just use the same way :
I = imread('cameraman.tif');
J = zeros(size(I,1), size(I,2));
coeff = numel(I)/4;
[B IX] = sort(I(:),'descend');
J(IX(1:coeff)) = 255;
imshow(uint8(J));
But, I think it takes a long time
4 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!