필터 지우기
필터 지우기

How to get image brightness ?

조회 수: 11 (최근 30일)
Gargolla9
Gargolla9 2021년 10월 13일
댓글: Gargolla9 2021년 10월 14일
Hi everyone! I am new to MATLAB Image Processing and I need your help. I need to build a code that calculates this instantaneous apparent brightness m_inst, related to the straight line in figure. The exposure time of the frame that I have attached here is one second. Can anyone help me?
I have worked on a code like this to obtain the brightness of the pixels belonging to that straight line but I don't know if it is useful for the calculation of apparent brightness:
A=rgb2gray(imread('Img_0685.bmp'));
B=bwareafilt(imbinarize(A-medfilt2(A,[5,5])) ,1) ;
pixelValues=A(B)
figure
imshow(B)

답변 (2개)

yanqi liu
yanqi liu 2021년 10월 14일
clc; clear all; close all;
A=rgb2gray(imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/766496/Img_0685.bmp'));
B=bwareafilt(imbinarize(A-medfilt2(A,[5,5])) ,1) ;
res=mean2(double(A(B)))
res = 230.1644
figure
imshow(B)

yanqi liu
yanqi liu 2021년 10월 14일
clc; clear all; close all;
A=rgb2gray(imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/766496/Img_0685.bmp'));
B=bwareafilt(imbinarize(A-medfilt2(A,[5,5])) ,1) ;
C=A.*uint8(B);
ci = unique(C(:));
ci_sum = 0;
for i = 1 : length(ci)
if ci(i) > 0
ci_num = length(find(C(:)==ci(i)));
ci_sum = ci_sum + ci_num;
end
end
n = length(find(C(:)>0));
csky = length(find(C(:)==0));
t = 1;
minist = 30 - 2.5*log10((ci_sum-n*csky)/t)
minist = 10.7431 - 3.4109i
figure
imshow(C)
  댓글 수: 1
Gargolla9
Gargolla9 2021년 10월 14일
Thank you for your idea but I think that something is wrong: for this frame that I have attached here and also for others frame that I have, the value of ci_sum and n is always the same; another problem is the fact that the final result, m_inst, is a complex value but it must be a real value.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by