필터 지우기
필터 지우기

imshow map image segmentation

조회 수: 1 (최근 30일)
Ahsen Feyza Dogan
Ahsen Feyza Dogan 2019년 7월 3일
답변: Alex Mcaulley 2019년 7월 3일
Hi,
I wrote a code but it does not show with scale I dont understand the reason.
Thank you
I=imread('mri.jpg');
J = imcrop(I,[197 180 130 165]);
%imshow(J);
[x,y]=size(J);
K=zeros(x,y);
cthresholdh=50;
cthresholdl=0;
for i=1:x
for j=1:y
if cthresholdh >= J(i,j) && J(i,j) >= cthresholdl
K(i,j)=1;
else
K(i,j)=0;
end
end
end
imshow(K,map);
  댓글 수: 1
Alex Mcaulley
Alex Mcaulley 2019년 7월 3일
What do you mean by "it does not show with scale"? Do you have any error? The question is not clear.
By the way, you don't need the loop nor x, y variables:
I=imread('mri.jpg');
J = imcrop(I,[197 180 130 165]);
%imshow(J);
K=zeros(size(J));
cthresholdh=50;
cthresholdl=0;
K(J >= cthresholdl & J <= cthresholdh) = 1;
imshow(K,map);

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

채택된 답변

Ahsen Feyza Dogan
Ahsen Feyza Dogan 2019년 7월 3일
mri.jpg

추가 답변 (2개)

Ahsen Feyza Dogan
Ahsen Feyza Dogan 2019년 7월 3일
Thank you I want to show like this image.
https://www.mathworks.com/help/examples/images/win64/MRISliceExample_02.png
  댓글 수: 1
Alex Mcaulley
Alex Mcaulley 2019년 7월 3일
Can you upload your image ('mri.jpg')?

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


Alex Mcaulley
Alex Mcaulley 2019년 7월 3일
You just need to tune the rectangle in the imcrop call to adjust it to the result you want. For example:
I=imread('mri.jpg');
J = imcrop(I,[90 70 340 410]); %Changed
%imshow(J);
K=zeros(size(J));
cthresholdh=50;
cthresholdl=0;
K(J >= cthresholdl & J <= cthresholdh) = 1;
imshow(K)
res.jpg
Is this that you want? If not, specify what are you looking for in detail.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by