필터 지우기
필터 지우기

How to apply thinning algorithm to color image

조회 수: 1 (최근 30일)
missC
missC 2014년 4월 16일
댓글: Image Analyst 2014년 4월 16일
Hi, is there any possible way to apply thinning algorithm to a color image. Exactly like the one I attached. I want to get single line drawing from the color image
Thank you

답변 (1개)

Image Analyst
Image Analyst 2014년 4월 16일
Try this for starters:
redChannel = rgbImage(:,:,1);
% Threshold (binarize) the red channel.
binaryImage = redChannel < 227; % Use triangle method to get the # automatically.
% Take largest blob. See attached demo. Then...
thinnedImage = bwmorph(binaryImage, 'skel', inf);
Adapt as necessary.
  댓글 수: 3
missC
missC 2014년 4월 16일
Now I got it sir. But how to preserve the color and the intensity of the image without convert to binary image? Or in other words thinned color/intensity image
Thanks.
Image Analyst
Image Analyst 2014년 4월 16일
You can't. It needs to be binary if you're going to skeletonize. After skeletonization you can convert to color if you want:
black = zeros(size(binaryImage), 'uint8');
rgbImage = cat(2, black, black, uint8(binaryImage));
Weight the components if you want a different color.

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

Community Treasure Hunt

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

Start Hunting!

Translated by