Crop ROI in an image.

조회 수: 6 (최근 30일)
Thulyo Neder
Thulyo Neder 2020년 9월 17일
편집: Thulyo Neder 2020년 9월 18일
Follow the script:
BW = roipoly (I, c, r);
figure, imshow (BW);
figure, imshow(uint8(BW).*I); %Generate the new image for the region selected.%

채택된 답변

Walter Roberson
Walter Roberson 2020년 9월 17일
uint8(BW).*I
should be fine.
However, for the selected region (inside the polygon) all the values are equal 1 and I need to have the same values as in the original matrix for this region of interest.
The result of the multiplication you do should be what you need.
I can’t manage to create regions that are not squares or rectangles.
You are not going to be able to create regions that are not rectangles. MATLAB can only store in cuboid arrays. MATLAB does not have any data structure that can store just a triangle (for example) with there literally being no memory for the area outside the triangle. Putting the shape inside a rectangular or cuboid region is all that you are going to be able to do.
There are very few programming languages that permit the creation of arrays that are not cuboid.

추가 답변 (0개)

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by