Any one who correct me the code,I want to find out the Potential P(X) ,but the image is more Spike.

1 次查看(过去 30 天)
clc; clear all; IKON = imread('IKON.jpg'); figure imshow(IKON); IKON = double(IKON); R=0:1:255; G=0:1:255; N=8; sigma= 0.333; %calculate h
<<
>>
% Y=argx/max{P(X)}; p=3; img=IKON; [n1,n2,n3]=size(img); % n1 = 10; % n2 =10; % n3 = 3; %neighbour B1=img; B1(2:n1,:)=img(1:n1-1,:); B2=img; B2(:,2:n2,:)=img(:,1:n2-1,:); B3=img; B3(1:n1-1,:,:)=img(2:n1,:,:); B4=img; B4(:,1:n2-1,:)=img(:,2:n2,:); B5=B1; B5(:,2:n2,:)=B1(:,1:n2-1,:); B6=B2; B6(1:n1-1,:,:)=B2(2:n1,:,:); B7=B3; B7(:,1:n2-1,:)=B3(:,2:n2,:); B8=B4; B8(2:n1,:,:)=B4(1:n1-1,:,:); %B(:,:,1)=B1(:,:,1); %B(:,:,2)=B2(:,:,1); %B(:,:,3)=B3(:,:,1); %B(:,:,4)=B4(:,:,1); %B(:,:,5)=B5(:,:,1); %B(:,:,6)=B6(:,:,1); %B(:,:,7)=B7(:,:,1); %B(:,:,8)=B8(:,:,1); X=1:n1; Y=1:n2; for i=1:3 B(:,:,1)=B1(:,:,i); B(:,:,2)=B2(:,:,i); B(:,:,3)=B3(:,:,i); B(:,:,4)=B4(:,:,i); B(:,:,5)=B5(:,:,i); B(:,:,6)=B6(:,:,i); B(:,:,7)=B7(:,:,i); B(:,:,8)=B8(:,:,i); BX=repmat(img(:,:,i),[1,1,8]); C=(2*pi)^(-1.5)*exp(-(BX-B).*(BX-B)/(2*h^2)); P=sum(C,3)/(8*h^3); figure % mesh(R(10:120)(G(10:120),P(10:120,10:120,) %mesh(R,G,P);% mesh(X,Y,P); %BX C P %BX = zeros(size(BX)); %C = zeros(size(C)); %P = zeros(size(P)); end
% % A=double(reshape(img,n1*n2,n3)); % for i=1:N % K(:,:,i)=(2*pi)^(-p/2)*exp(-((A-repmat(A(1,:),n1*n2,1))/h).^2/2); % end % P=1/N/h^p*sum(K,3); % % Xm=mean(A); % Pmax=max(P); % if Pmax==Xm % Y=Xm; % else

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by