how to create a fan shape/ arc inside an image?

조회 수: 6 (최근 30일)
BA
BA 2022년 10월 11일
댓글: BA 2022년 10월 12일
I want to change the rectangular into fan-shape or arc.
  댓글 수: 3
KSSV
KSSV 2022년 10월 12일
Why don't you s how us your expectations as an example image if possible.
BA
BA 2022년 10월 12일
편집: BA 2022년 10월 12일
@DGM@KSSVit's one image and I want to convert the rectangular into fan-shape/polar (attached is the example of the fan-shape). In fact, the rect's image is done in python, here is the code:
roi_upper = 310
roi_lower = 140
roi_left = 80
roi_right = 525
rec = np.zeros(df.shape, dtype=m_df.dtype)
rec[roi_lower:roi_upper,roi_left:roi_right] = 1
img_ro = df * rec

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

답변 (1개)

KSSV
KSSV 2022년 10월 12일
May be something like this:
[I,map] = imread('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1152743/rect.png') ;
[m,n,p] = size(I) ;
R = linspace(0.5,1,n) ;
th = linspace(pi/4,3*pi/4,m) ;
[R,T] = meshgrid(R,th) ;
X = R.*cos(T) ;
Y = R.*sin(T) ;
warp(X,Y,ones(size(X)),I)
view(2)
  댓글 수: 3
KSSV
KSSV 2022년 10월 12일
You may use imcrop and pick the part of the image you want.
BA
BA 2022년 10월 12일
@KSSVdo you have an idea to convert your code into python so I can try on that on original image?

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

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by