还要怎么做才能得到处理的图像,或者是原图和去雾处理的结果图,以及他们的直方均衡图啊,就差最后一步不会了,好难受啊😭
global im;
global orig;
[filename, pathname]=uigetfile(['C:\Program Files\Polyspace\R2021a\bin\3.jpg'],'insert image');
im=[pathname filename];
orig = imread(im);
Q = rgb2gray(orig);
figure;
subplot(1, 2, 1); imshow(orig); title('原图像')
subplot(1, 2, 2); imhist(Q, 64); title('原图像直方图')
global orig;
global U;
I = rgb2hsv(orig);
H = I(:,:,1);
S = I(:,:,2);
V = I(:,:,3);
M = histeq(S); % 对饱和度直方图均衡化
N = histeq(V); % 对亮度直方图均衡化
U = hsv2rgb(H, M, N);
figure;
subplot(2, 2, 1); imshow(orig); title('原图像')
subplot(2, 2, 2); imshow(U); title('均衡后图像')
Q = rgb2gray(orig);
W = rgb2gray(U);
subplot(2, 2, 3); imhist(Q, 64); title('原图像直方图')
subplot(2, 2, 4); imhist(W, 64); title('均衡变换后的直方图')
global im;
im1=double(imread(im));
sv=2*floor(max(size(im1))/25)+1;
res=visibresto1(im1,sv,-1);
figure;imshow([im1, res],[0,1]);
以下回答引用自chatGpt, 有用的话,请采纳哇,这对我很重要!!!
根据你提供的代码,似乎缺少了进行去雾操作的代码部分。如果你已经编写了去雾操作的代码但结果图无法出来,可以考虑以下可能的问题:
当下图像处理中常见的去雾方法是单幅图像的去雾,即只利用输入图像,不依赖于其他信息。其中最经典的方法是He等人提出的Dark Channel Prior算法。以下是一个基于该算法的MATLAB代码示例:
% Dark Channel Prior
%
% This code is the implementation of the algorithm described in the paper:
%
% "Single Image Haze Removal Using Dark Channel Prior"
% by Kaiming He, Jian Sun, and Xiaoou Tang, in IEEE Transactions
% on Pattern Analysis and Machine Intelligence, vol. 33, no. 12, pp. 2341-2353, Dec. 2011.
%
% The code reads an image, performs the haze removal, and then saves the output.
%
% This code is free to use for research purposes only. For commercial use,
% please contact the authors of the paper above.
%
% Jingda Wu, 06/03/2018.
%
% Reference: https://github.com/JingdaMai/Dark-Channel-Prior
%% Read image
I = imread('input.jpg');
figure,imshow(I),title('Original image');
%% Estimate atmospheric light
darkChannel = min(I,[],3);
[height,width] = size(darkChannel);
pixelsNum = height * width;
% Number of pixels to pick up for atmospheric light estimation
numPixels = floor(pixelsNum * 0.001);
% Sort dark channel value in descending order
darkChannelVector = reshape(darkChannel,pixelsNum,1);
darkChannelVector = sort(darkChannelVector,'descend');
atmosphericLight = zeros(1,3);
% Estimate atmospheric light
for k = 1:numPixels
[y,x] = find(darkChannel == darkChannelVector(k));
atmosphericLight = max(atmosphericLight,double(I(y,x,:)));
end
%% Haze removal
t = zeros(size(darkChannel));
for y = 1:height
for x = 1:width
t(y,x) = 1 - 0.95 * (min(I(y,x,:)) ./ atmosphericLight);
end
end
t = medfilt2(t,[15 15]); % Median filtering
J = zeros(size(I));
for y = 1:height
for x = 1:width
J(y,x,:) = (double(I(y,x,:))-atmosphericLight) ./ max(t(y,x),0.1) + atmosphericLight;
end
end
figure,imshow(J),title('Dehazed image');
imwrite(J,'output.jpg');
需要注意的是,该代码仅用于研究目的,商业用途需得到原作者许可。另外,该代码仅适用于单幅图像的去雾操作,对于有其他条件信息的去雾操作,需要使用其他算法或者深度学习方法。
1s3+2s2+s和1s2+2s+1\frac{1}{s^3+2s^2+s} 和 \frac{1}{s^2+2s+1}s3+2s2+s1和s2+2s+11