how can i apply an oval mask to extract face region?
조회 수: 7 (최근 30일)
이전 댓글 표시
how can i apply an oval mask to extract face region?
댓글 수: 0
답변 (1개)
DGM
2023년 3월 20일
Oh well if you want an oval, you're in luck. This is one way to generate oval masks.
inpict = imread('peppers.png');
[rows,cols,~] = size(inpict);
% generate a binary mask containing multiple ovals
[x y] = makeoval(60,[120 120],-60,'type','stadium');
mask = poly2mask(x,y,rows,cols);
[x y] = makeoval(80,[250 270],-100,'type','superegg');
mask = mask | poly2mask(x,y,rows,cols);
[x y] = makeoval(80,[400 120],-130,'type','ellipse','ratio',1.5);
mask = mask | poly2mask(x,y,rows,cols);
imshow(mask)
% apply the mask
outpict = im2uint8(double(mask).*im2double(inpict));
imshow(outpict)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!