Hi!!! I have segmented the output using global thresholding for an image.Now I am finding it difficult to find the textural features using local binary pattern.The code below showsglobal thresholding done on a woud image.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I now need to find the texture features using local binary pattern on the segmented output (Y) of this code output.Someone Please help me with the code . clc; clear all; imtool close all; % Close all imtool figures. clear; % Erase all existing variables. workspace; % Make sure the workspace panel is showing. fontsize = 20; A=imread('im1.jpg'); subplot(4,4,1);imshow(A);title('original Image'); x=rgb2gray(A); subplot(4,4,2);imshow(x);title('RGB Image');
%Represent the RGB image in [0 1] range I=double(A)/255; R=I(:,:,1); G=I(:,:,2); B=I(:,:,3); %Hue numi=1/2*((R-G)+(R-B)); denom=((R-G).^2+((R-B).*(G-B))).^0.5; %To avoid divide by zero exception add a small number in the denominator H=acosd(numi./(denom+0.000001)); %If B>G then H= 360-Theta H(B>G)=360-H(B>G); %Normalize to the range [0 1] H=H/360; subplot(4,4,3);imshow(H);title('H channel img'); %Saturation S=1-(3./(sum(I,3)+0.000009)).*min(I,[],3); s=imadjust(S); subplot(4,4,4);imshow(s);title('S channel img'); %Intensity I=sum(I,3)./4; subplot(4,4,5);imshow(I);title('I channel img'); %HSI HSI=zeros(size(A)); HSI(:,:,1)=H; HSI(:,:,2)=S; HSI(:,:,3)=I; subplot(4,4,6);imshow(HSI);title('HSI Image');
x1=im2single(s); [m, n]=size(s); Err =1; T0=(max(max(x1))+min(min(x1)))/2; while Err > 0.0009
u1=0;
u2=0;
cnt1=0;
cnt2=0;
for i=1:m
for j=1:n
if x1(i,j)<= T0
u1=u1+x1(i,j);
cnt1=cnt1+1;
else
u2=u2+x1(i,j);
cnt2=cnt2+1;
end
end
end
u1=u1/cnt1;
u2=u2/cnt2;
T=(u1+u2)/2;
Err=abs(T-T0);
if Err > 0.0009
T0=T;
end
end y=im2bw(HSI,T0); subplot(4,4,7);imshow(y);
0 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!