Filter löschen
Filter löschen

How to extract the region of interest?

29 Ansichten (letzte 30 Tage)
Sabarinathan Vadivelu
Sabarinathan Vadivelu am 21 Sep. 2012
Kommentiert: Suniti Singh am 5 Apr. 2021
Considering an image, imrect function displays the ROI. Now I want to extract the ROI and to be stored in another variable and displayed.
figure, imshow(inputImage);
I = imrect(gca,[50 50 100 100]);
  4 Kommentare
Image Analyst
Image Analyst am 28 Nov. 2017
What is "leveling"? Start a new question and post your image.
Suniti Singh
Suniti Singh am 5 Apr. 2021
Hello sir I am working on medical image security. can you please help me with the code of svm classsification to classify the image into roi and nroi.
Thanks & Regards

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 21 Sep. 2012
Use imcrop().
grayImage = imread('pout.tif');
imshow(grayImage);
h = imrect;
position = wait(h);
croppedImage = imcrop(grayImage, position);
figure;
imshow(croppedImage);
  3 Kommentare
Image Analyst
Image Analyst am 15 Jan. 2014
Bearbeitet: Image Analyst am 15 Jan. 2014
It is a built - in function. The code is straight out of the MATLAB help documentation for imrect . If you have wait, it will wait for you to double-click to accept the rectangle. If you don't have it, it finishes as soon as you lift the mouse button. You can do it without waiting and without using the wait function like this:
h = imrect;
% Wait for user.
% Comment out if you don't want to wait for confirmation.
% position = wait(h);
position = getPosition(h)
Explorer
Explorer am 21 Jan. 2014
Okay

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Amruta Talreja
Amruta Talreja am 1 Mär. 2017
Hello Image Analyst. I got a ROI from the below code and now I want to label it. Please help me with the code of labeling a ROI. Thank you in advance. S = [1 1 50 50]; %the size of your ROI starts at point X1, Y1 I = imread('T1.tif'); % your input image figure, imshow(I); h = imrect(gca, S);
addNewPositionCallback(h,@(p) title(mat2str(p,3))); fcn = makeConstrainToRectFcn('imrect',get(gca,'XLim'),get(gca,'YLim')); setPositionConstraintFcn(h,fcn)
position = wait(h); I2 = imcrop(I,position); imshow(I2); % the output image of your ROI
  2 Kommentare
Image Analyst
Image Analyst am 1 Mär. 2017
What does labeling mean to you?
In the meantime, look at these functions bwlabel(), bwconncomp(), text(), annotation().
prahlad h
prahlad h am 1 Mär. 2017
This is not directly related to my question, but Image Analyst, could you please answer this? segmentation question

Melden Sie sich an, um zu kommentieren.


Thilakam kuttiannan
Thilakam kuttiannan am 3 Sep. 2018
sir Can you please send me the coding for ROI for a given image
  3 Kommentare
Matpar
Matpar am 29 Feb. 2020
I am trying to understand the labelling process, please guide me..
I have 40 images for which I have labelled the region of interest ROI via the Matlab app! This was taken from the stopsign example in mathworks.
I am having some challgenges understanding how to code in the images that does not contain the region of Interest! Where does that bit fit in?
Please help me to undertand this, I am stuck and cannot move forward until I gather this understanding..
Thus far I researched the labelling process but no where I am seeing where they are implementing the processes for the non ROI images. or is this being called some where other and I am not seeing this
Image Analyst
Image Analyst am 29 Feb. 2020
It would be mostly the same code, but after segmentation you'd just check for no blobs:
[labeledImage, numberOfRegions] = bwlabel(binaryImage);
if numberOfRegions == 0
% No blobs found. Just exit
return;
end
% Blobs found, so continue
props = regionprops(labeledImage, 'Area')

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by