clear all; close all; clc; path = '超声图像/清晰/8.jpg'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % path = '超声图像/不清晰/3.jpg'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % path = '超声图像/不清晰2/11.jpg'; % path = '灰色.jpg'; Img = imread(path); if size(Img,3) == 3 Img = rgb2gray(Img); end [h,w]=size(Img); if h<64 Img = imresize(Img, [64, w], 'bilinear'); h=64; end if w<64 Img = imresize(Img, [h, 64], 'bilinear'); w=64; end figure; subplot(2,2,1); imshow(Img); title('Original Image'); sigma = 2.0; K=fspecial('gaussian',15,sigma); % 15 Caussian kernel gausImg = conv2(double(Img),double(K),'same'); % gausImg = conv2(Img, K,'same'); gausImg8 = uint8(gausImg); subplot(2,2,2); title('Smoothed image'); % imshow(gausImg,[0, 255]); imshow(gausImg8); val1 = CPBD_compute(Img); val2 = CPBD_compute(gausImg8); val = val1 - val2;