필터 지우기
필터 지우기

Find a range in a matrix and rescale it

조회 수: 3 (최근 30일)
Ben Ma
Ben Ma 2021년 9월 8일
댓글: Ben Ma 2021년 9월 8일
In a image, those in the range [120 230] are scaled into range [0 120].
How to do it? Thanks.
if (a>120/255) & (a<230/255)
a==0;
end
I tried something like this but it doesnt work. Thanks.

채택된 답변

KSSV
KSSV 2021년 9월 8일
편집: KSSV 2021년 9월 8일
Let A be your image:
A0 = A ; % save for test
idx = A >= 120 & A<= 230 ; % get indices of required values
val = A(idx) ; % values
val_rescale = rescale(val,0,120) ; % scale the values
A(idx) = val_rescale ; % replace
  댓글 수: 3
KSSV
KSSV 2021년 9월 8일
Typo error...val should be used in the function rescale. Edited the answer.
Ben Ma
Ben Ma 2021년 9월 8일
Thanks a lot.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by