Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 如何实现平台极限直方图均衡化算法_Matlab_Image Processing - Fatal编程技术网

Matlab 如何实现平台极限直方图均衡化算法

Matlab 如何实现平台极限直方图均衡化算法,matlab,image-processing,Matlab,Image Processing,我一直在尝试实现一个简单而简短的算法。我将结果的直方图与原始结果的直方图进行比较,结果总是存在巨大差异。 我一次又一次地检查我的代码。但我看不出问题出在哪里。我发布了步骤和我的尝试。我的错在哪里 除了打印结果中的一个小细节外,一切都是正确的,您应该将输出图像从双精度转换为无符号整数。output\u image=uint8(output\u image) 这些元素不是,因为在最坏的情况下,如果原始直方图为0,那么修改后的直方图值将为0.4805,也许你的意思是原始直方图中不是零?当我更改

我一直在尝试实现一个简单而简短的算法。我将结果的直方图与原始结果的直方图进行比较,结果总是存在巨大差异。

我一次又一次地检查我的代码。但我看不出问题出在哪里。我发布了步骤和我的尝试。我的错在哪里


除了打印结果中的一个小细节外,一切都是正确的,您应该将输出图像从双精度转换为无符号整数。
output\u image=uint8(output\u image)


这些元素不是,因为在最坏的情况下,如果原始直方图为0,那么修改后的直方图值将为0.4805,也许你的意思是原始直方图中不是零?当我更改原始直方图的代码时。我看到了比这更糟糕的结果。据我所知,在使用histeq()指令时,您希望您的直方图看起来像直方图,分布在所有存储箱上,而不是大部分存储箱上,对吗?是的。算法也说明了这一点,不是吗?当然会有区别,但有一点区别,因为你做了直方图处理,你应用传递函数来增强你的图像,这意味着你增加了你的图像对比度,增加对比度意味着在你的直方图中使用未使用的箱子(在靠近1和256的边界上),你会在中间的直方图中散布未使用的箱子,所以当然会改变!好的,我明白了,可能是因为我们使用不同的图像,我在这里使用Lena.png,我使用研究论文的原始输出和输入图像。我必须彻底阅读该论文才能看到其他小细节,不幸的是,我没有在IEEExplore网站上的帐户来阅读该论文并向您提供反馈,因为到目前为止,您所实现的与所编写的完全相同。除非有额外的细节或进一步的后处理如果空间分辨率不同,直方图当然会不同,直方图只是图像上离散灰度级计数的表示,它取决于像素计数和像素灰度
histogram_of_image = imhist(input_image);
modified_histogram = zeros(1,256);
modified_histogram(1:256)  = (log(histogram_of_image(1:256)+(a))).^(beta);
these_elements_are_not_zero = modified_histogram~= 0;
sum2 = sum(modified_histogram(these_elements_are_not_zero));
cnt2 = size(these_elements_are_not_zero,2);
tcl = sum2/cnt2;
clipped_histogram = zeros(1,256);
for i=1:256
    if((modified_histogram(i)) >= tcl)
    clipped_histogram(i) = tcl;    
    else 
    clipped_histogram(i) = (modified_histogram(i));   
    end
end
PDa = zeros(1,256);
PDa = clipped_histogram / (sum(clipped_histogram)); 
CDa = zeros(1,256);  %create CDa in formula
CDa(1) = PDa(1) ;
for i=2:256
     CDa(i) =  PDa(i) +  CDa(i-1);  
end
value_after_enhancement =  zeros(1,256); 
value_after_enhancement = (255 * CDa); 
b=uint8(0);
output_image=zeros(width,height);
output_image =   value_after_enhancement(input_image+1);
figure;imshow(uint8(output_image));
original_result=imread('testsonuc.bmp');
original_result=double(rgb2gray(original_result));
image_of_dif= zeros(width,height);
figure;imshow(uint8(original_result));
%value_after_enhancement =  zeros(1,256);
value_after_enhancement = (255 * CDa)+1;
%b = uint8(0);
%output_image = zeros(width,height);
output_image = value_after_enhancement(input_image);
output_image = uint8(output_image);
%dif_image = output_image ./ input_image;
%===================================================================
figure('Name','Algorithm Result','NumberTitle','off');
subplot(211);
imshow(output_image);
subplot(212);
Out_Hist = imhist(output_image);
plot(Out_Hist);