clc; clear all; close all; image1=imread('C:\Users\dell pc\Pictures\mandrilll.jpg'); im1=imresize(image1,[256 256]); im2=im2uint8(im1); subplot(2,2,1); figure(1); imshow(im2);title('original image'); image2=stdfilt(im2); image3=im2uint8(image2); subplot(2,2,2); imshow(image3); title('standard deviation map'); level = graythresh(image3); s= im2bw(image3,level); subplot(2,2,3); imshow(s); title('binarized standard deviation map'); numBlkH = 4; numBlkW = 4;
%# compute size of each tile in pixels [imgH,imgW,~] = size(s); szBlkH = [repmat(fix(imgH/numBlkH),1,numBlkH-1) imgH-fix(imgH/numBlkH)*(numBlkH-1)]; szBlkW = [repmat(fix(imgW/numBlkW),1,numBlkW-1) imgW-fix(imgW/numBlkW)*(numBlkW-1)];
%# divide into tiles, and linearize using a row-major order C = mat2cell(s, szBlkH, szBlkW)'; C = C(:);
%# display tiles i subplots figure for i=1:numBlkH*numBlkW subplot(numBlkH,numBlkW,i), imshow( C{i} ) end image1=imread('C:\Users\dell pc\Pictures\mandrilll.jpg'); im1=imresize(im1,[256 256]); im2=im2uint8(im1); numBlkH = 4; numBlkW = 4;
%# compute size of each tile in pixels [imgH,imgW,~] = size(im2); szBlkH = [repmat(fix(imgH/numBlkH),1,numBlkH-1) imgH-fix(imgH/numBlkH)*(numBlkH-1)]; szBlkW = [repmat(fix(imgW/numBlkW),1,numBlkW-1) imgW-fix(imgW/numBlkW)*(numBlkW-1)];
%# divide into tiles, and linearize using a row-major order P = mat2cell(im2, szBlkH, szBlkW)'; P = P(:); %# display tiles i subplots for i=1:numBlkH*numBlkW subplot(numBlkH,numBlkW,i), imshow( P{i} ) end figure a=1;b=1; for i=1:16 c1(:,:,i)=cell2mat(C(i)); p1(:,:,i)=cell2mat(P(i)); sum1=sum(sum(c1(:,:,i))); t(:,:,i)=sum1/(64*64); if t < 0.85 poortext(:,:,a)=c1(:,:,i); poortext1(:,:,a)=im2double(p1(:,:,i)); a=a+1; else text(:,:,b)=c1(:,:,i); text1(:,:,b)=p1(:,:,i);
b=b+1; endend for i=1:a-1 d=(poortext1(:,:,i)); subplot(4,4,i) imshow(d); title('poor-texture'); end figure for i=1:b-1 d1(:,:,i)=(text1(:,:,i)); d2=d1(:,:,i); subplot(4,4,i) imshow(d2); title('texture'); end
could anyone help me to solve the error. thanks in advance.
Best Answer