IMAGE BINARIZE determine THRESHOLD

조회 수: 3 (최근 30일)
mohd akmal masud
mohd akmal masud 2021년 1월 20일
댓글: mohd akmal masud 2021년 1월 21일
Hi,
i have one set data image grey scale. pixel value from 0 - 1300.
Then i want to threshold is 1300*0.4 = 520 . then the pixel number greater than 520 is 1, the pixel value smaller than 520 is 0.
Then this is my coding,
spect = dicomread ('astitr8sub32.dcm');
MAX = max(max(max(spect)));
T = MAX*0.4;
PVmin = T;
PVmax = MAX;
spect(spect<PVmin)=0;
spect(spect>PVmax)=0;
spect(spect~=0)=1;
spectmax=max(max(max(spect));
spectmin=min(min(min(spect)));
spectrange=spectmax-spectmin;
now i want convert my grey scale to binary image using function adaptthresh,
spect = dicomread ('astitr8sub32.dcm');
MAX = max(max(max(spect)));
T = adaptthresh(spect, 0.4);
BW = imbinarize(spect, T);
spect(spect==BW)=0;
spect(spect==BW)=1;
spectmax=max(max(max(spect)));
spectmin=min(min(min(spect)));
spectrange=spectmax-spectmin;
BUT i GOT ERROR.
CAN SOME ONE HELP ME?
  댓글 수: 3
KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 1월 20일
I did not find any coding error, more this
max(max(max(spect)));
can be replace by
max(spect(:));
mohd akmal masud
mohd akmal masud 2021년 1월 21일
tq all sir. it work

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

답변 (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