MATLAB: HI to all.. this is about thresholding the image .. thresholding 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 Best Answer 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)) = 1The 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 9J = 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1To 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 Related SolutionsMATLAB: I want to calculate the equation: I = [5 6 7 8 ; 2 8 6 3 ; 4 0 4 2 ; 5 0 1 0]; [l, ~, iI] = unique(I); nk = accumarray(iI, 1); XT = l'*nk/numel(I) MATLAB: How can I reduce the padding Try thisA = [ ...0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 2 6 7 0 00 0 6 8 8 0 00 0 1 3 5 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0];[r,c] = find(A);rs = min(r):max(r);cs = min(c):max(c);A_compact = A(rs,cs);Result>> A_compactA_compact = 2 6 7 6 8 8 1 3 5 Related QuestionIndexing Based On Cell ArrayPlease help in this program. is to find the index of zeros which is in consecutive order which should more or equal to 5 time.How to find the location of element in matrixConvert whole image into non-overlapping blocks of size 8*8 pixelsProblem in perimeterShowing multiple images in one window in Matlab
Best Answer