problem finding roi formula for ct scan image

조회 수: 2 (최근 30일)
Nur Yahdillah
Nur Yahdillah 2020년 6월 2일
답변: Sulaymon Eshkabilov 2020년 6월 2일
Before that, I'm sorry if my English is too bad. I want to find a formula for roi ct-scan images, but I am confused to enter the rect formula, what do you think about my formula? please help me show how the formula is right.
clc;clear
img = dicomread('Z17');
figure,imshow(img,[])
title('citra asli')
img2=imcomplement(img);
figure,imshow(img2,[])
title('citra negatif')
[x,y]=getpts;
a=x;
b=y;
xs=a;
ys=b;
rect=[xs-25 ys-25 100 50];
ROI=(imcrop(img,rect));
  댓글 수: 1
Image Analyst
Image Analyst 2020년 6월 2일
Where do you expect the user to click? You're cropping out a subimage that starts up and to the left 25 pixels. Also you do not need parentheses around (outside) the imcrop() function. And there really seems no reason to have a, b, xs, and ys at all when you could simply do
rect = [x-25, y-25, 100, 50];

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

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020년 6월 2일
If you'd need to collect the coordinates of a few selected points by a user, then you'd need to use:
[x, y]=ginput(1); % Selects the coordinates of 1 point (x1, y1)
rect = [x-25, y-25, 100, 50];

카테고리

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