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

조회 수: 4 (최근 30일)
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
Walter Roberson
Walter Roberson 2022년 6월 28일
Is there a reason you reopened this when the discussion is taking place in the other copy of the question?
David Corwin
David Corwin 2022년 6월 29일
I didn't see how to reopen the question. I have matlab 2016b. Does your solution require an upgrade?

댓글을 달려면 로그인하십시오.

채택된 답변

DGM
DGM 2022년 6월 27일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by