How can adjust luminosity with HSV?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello friends, I have a set of 20 color images and I want to implement some operations.but before working on these images, I must homogenize the luminance (HSV) someone can suggest me a way to do this. I have done the following code, anda I want get the array of all image luminance average, but my problem is since the image is obtained by a for loop when a try change the image in rgb2hsv give me this error
if true
% code
Error using rgb2hsv (line 59)
MAP must be a Mx3 array.
Error in teste (line 15)
hsv = rgb2hsv(a)
end
the code :
if true
% code
clear all, close all, clc;
imgDir = dir(fullfile('','/database/*.jpg'));
outDir = '/resultados/';
imgDimensao = length(imgDir);
data =zeros(1,imgDimensao)
for x = 1:length(imgDir)
handles.images{x}=imread(fullfile('','/database/',imgDir(x).name));
a = imgDir(x).name;
hsv = rgb2hsv(a)
a = mean2(a);
data(x) = a ;
end
data
mean2(data
end
댓글 수: 0
채택된 답변
Image Analyst
2015년 6월 16일
THe badly-named "a" must be an RGB image, not a filename string. And don't use hsv as an image name since it's a built-in function.
rgbImage =imread(fullfile('','/database/',imgDir(x).name));
hsvImage = rgb2hsv(rgbImage);
meanValues(x) = mean2(hsvImage (:,:, 3));
After the loop, you can get the overall mean by doing this:
meanV = mean(meanValues);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!