Divide an image vertically into two equally luminous parts, bisect these two parts, calculate the luminance of each part....
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
David Corwin
am 27 Jun. 2022
Kommentiert: David Corwin
am 29 Jun. 2022
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 Kommentare
Walter Roberson
am 28 Jun. 2022
Is there a reason you reopened this when the discussion is taking place in the other copy of the question?
Akzeptierte Antwort
DGM
am 27 Jun. 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')
sum(Ae,'all')
% 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')]
% 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]
% weight center vectors by luma
allv = allv.*allluma
% find the sum
sumv = sum(allv,1)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!