Crop with imfreehand?
古いコメントを表示
I dont know if my question has an answer.I have an image and crop a ROI with imcrop
[cropped_image,rect]=imcrop(original_image);
I work with cicular regions so this rectangular is not working very well.I want to draw freehand the ROI i want..
I tried this but doesnt work.(I want to get similar image such as cropped_image)
cropped_image=imfreehand();
and then extract this cropped_image and continue to my analysis
採用された回答
その他の回答 (1 件)
Image Analyst
2019 年 2 月 3 日
1 投票
See my attached demo. I think you'll like it a lot better than the other answer. It gives you drawing instructions, it doesn't ask you to "confirm" the shape after you draw it, it does a variety of masking options, and it does the cropping you want. Adapt as needed.

4 件のコメント
DIMITRIOS THEODOROPOULOS
2019 年 2 月 3 日
Warid Islam
2019 年 7 月 22 日
Hi @ImageAnalyst,
I tried to draw a boundary using the freehand() above. Below is the image.

However, problem arises when I try to crop that specific portion of the image defined by the boundary and save it in a different file. The following error message is displayed.
Unrecognized method, property, or field 'getPosition' for class 'images.roi.Freehand'.
Error in freehand_masking_demo (line 49)
xy = hFH.getPosition;
Any suggestions would be very much appreciated. Thank you.
Image Analyst
2019 年 7 月 23 日
Warid, what version do you have?
Warid Islam
2019 年 7 月 23 日
Hi,
I use MATLAB 2019a.
カテゴリ
ヘルプ センター および File Exchange で ROI-Based Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!