Transformation function on image

조회 수: 1 (최근 30일)
Miles Hao Peng Su
Miles Hao Peng Su 2022년 9월 28일
댓글: Miles Hao Peng Su 2022년 9월 28일
Hi guys, may I ask how do I implement a transformation function on an image?
Maybe it's a function like this: T : , where x is any number and k is the grey scale level, used on a 256 level grey image.
function [Iout,m,mu2,mu3] = enh(Iin,a,b) %take in values of a and b
I = Iin;
for i = 1:254
I(I == i) = a*(i+b);
end
Iout = I;
...
Here is my recent attempt, where I tried to loop the matrix through (Iin) and writes in new values with each loop.
However the code did not work. All the values became 255 after passing through enh
May I know how do you do this?

채택된 답변

Image Analyst
Image Analyst 2022년 9월 28일
If r is the input image, and k is your scalar number, you can create output image s simply by doing this:
s = k * r;
  댓글 수: 1
Miles Hao Peng Su
Miles Hao Peng Su 2022년 9월 28일
Thanks! This is a much easier way to solve this quesition

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by