Apply adaptive histogram equalization at the bottom part of the image

1 回表示 (過去 30 日間)
SS
SS 2021 年 4 月 21 日
編集済み: SS 2021 年 4 月 25 日
Hi. I have a set of 2000 tif images of size 1024 X 1024 pixels in a folder and I want to apply histogram equalization only at the bottom part of the image. Say from y = 800 px to y = 1024 px, and make the rest (top part) of the image black. How can I incorporate this in the below code?
% Location of the original files
d = 'D:\Raw_Images\';
% Location of the new files
drive1='D:\New Imagews\';
for i=1:2000
num=sprintf('%03.0f\n',i);
name=strcat(d,'B_',num,'.tif');
I=imread(name);
J=adapthisteq(I,'NumTiles',[8 8],'clipLimit',0.1,'Distribution','uniform');
imwrite(J,strcat(drive1,'B_',num,'.tif'),'Compression','none');
end

採用された回答

DGM
DGM 2021 年 4 月 21 日
Something like this.
inpict=imread('someparticularimage.tiff');
tophalf=zeros([799 size(inpict,2) size(inpict,3)],class(inpict));
bothalf=inpict(800:end,:,:);
for c=1:size(inpict,3)
bothalf(:,:,c)=adapthisteq(bothalf(:,:,c),allmyfavoriteargumentsgohere);
end
outpict=cat(1,tophalf,bothalf);
This assumes the images may be color. If you can be assured that they are all single-channel images, the loop would be unnecessary.
  1 件のコメント
SS
SS 2021 年 4 月 22 日
編集済み: SS 2021 年 4 月 25 日
Hi, thanks for your reply. It worked well.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by