How to detect brightness of the image and adjust automatically?

14 Ansichten (letzte 30 Tage)
I have a folder of images which contains different brightness images. From this folder, I want to identify those that are too bright or dull and automatically make adjustment to them. As for the rest of the images that meet the criteria will be left alone.
Thanks in advance.

Akzeptierte Antwort

Sai Bhargav Avula
Sai Bhargav Avula am 12 Aug. 2019
If the files are sequentially named, then you can read them using the following code.
path_directory='folder_name'; % 'Folder name'
original_files=dir(['path_directory '/*.jpg']); % for this case jpg
for k=1:length(original_files)
filename=fullfile('path_directory', original_files(k).name);
image_orginal=imread(filename); % Image read is done
%%Image Operation as per your work
end
The brightness of the image can be calculated by your definition of brightness. For example it can be calculated by the V color of the HSV color space
This goes below “%%Image Operation as per your work” in the code given above.
hsvImage = rgb2hsv(filnename); % HSV color map convertion
brightness = hsvImage(:, 3); % calculating the
Other way would be to find the mean of the image
brightness = mean2(filename);
Using the brightness values the adjustments can be made for each image.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by