Divide an image vertically into two equally luminous parts, bisect these two parts, calculate the luminance of each part....

4 visualizaciones (últimos 30 días)
a. convert a picture to gray scale
rgbImage = imread('photo.jpg');
grayImage = rgb2gray(rgbImage);
b. divide the picture vertically such that the two parts (left and right) have equal luminance
c. . bisect each part so that there are now four parts to this picture Upper left, Upper right, lower left lower right
and. obtain the average luminance of each part.
d. obtain the vector of luminance for each part:: the luminance value multiplied by the distance from the point of intersection to the geometric center of the respective part.
e. However, for the two upper parts, the x,y value of this vector is replaced by x,(1.07)y. in other words the vertical component is lightened by 1.07
f.. add the four resultant vectors to obtain the distance from the intersection
  2 comentarios
Walter Roberson
Walter Roberson el 28 de Jun. de 2022
Is there a reason you reopened this when the discussion is taking place in the other copy of the question?
David Corwin
David Corwin el 29 de Jun. de 2022
I didn't see how to reopen the question. I have matlab 2016b. Does your solution require an upgrade?

Iniciar sesión para comentar.

Respuesta aceptada

DGM
DGM el 27 de Jun. de 2022
Something like this?
A = imread('peppers.png');
A = rgb2gray(A); % BT601 luma
A = im2double(A);
% split the image into two halves of approx equal weight
Aps = cumsum(sum(A,1),2);
lastidx = find(Aps<=(max(Aps)/2),1,'last');
Aw = A(:,1:lastidx);
Ae = A(:,lastidx+1:end);
% show the weights are close to equal
sum(Aw,'all')
ans = 3.1441e+04
sum(Ae,'all')
ans = 3.1520e+04
% bisect halves
hh = round(size(A,1)/2);
Anw = Aw(1:hh,:);
Asw = Aw(hh+1:end,:);
Ane = Ae(1:hh,:);
Ase = Ae(hh+1:end,:);
% average luma for each quarter
allluma = [mean(Anw,'all'); mean(Anw,'all');
mean(Ane,'all'); mean(Ase,'all')]
allluma = 4×1
0.2731 0.2731 0.3089 0.3225
% find geometric center vectors
center = [lastidx hh]; % [x y]
allv = [center/2; % [nw; sw; ne; se]
lastidx/2 hh*1.5;
lastidx*1.5 hh/2;
center*1.5];
allv = (allv - center).*[1 1.07; 1 1; 1 1.07; 1 1]
allv = 4×2
-126.0000 -102.7200 -126.0000 96.0000 126.0000 -102.7200 126.0000 96.0000
% weight center vectors by luma
allv = allv.*allluma
allv = 4×2
-34.4152 -28.0565 -34.4152 26.2211 38.9191 -31.7284 40.6378 30.9621
% find the sum
sumv = sum(allv,1)
sumv = 1×2
10.7266 -2.6017

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by