How can adjust luminosity with HSV?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Biza Ferreira
el 16 de Jun. de 2015
Comentada: Biza Ferreira
el 16 de Jun. de 2015
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 comentarios
Respuesta aceptada
Image Analyst
el 16 de Jun. de 2015
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);
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!