Conversion of grayscale to binary Image

조회 수: 9 (최근 30일)
ANUSHA H P
ANUSHA H P 2022년 1월 17일
편집: ANUSHA H P 2022년 1월 21일
when a dataset containing gray scale images are converted to binary images , few images are getting complemented i.e, few images with black as background and few with white as background.
I want all images to be in a uniform way, black background and white foreground.
how to use imcomplement() for selected images in a datasset? or is there anyother way?
i have attached few sample input and their corresponding binary images from the dataset.
Thankyou in advance

채택된 답변

Image Analyst
Image Analyst 2022년 1월 17일
There is an option for that in imbinarize to make sure you always get either the brighter thing or the darker thing:
BW = imbinarize(grayImage,'adaptive','ForegroundPolarity','dark','Sensitivity',0.4);
  댓글 수: 8
Image Analyst
Image Analyst 2022년 1월 20일
If you want the shape to better hug/follow the binary image, instead of using the convex hull, you could fill the blobs and use activecontour. See attached demo.
ANUSHA H P
ANUSHA H P 2022년 1월 21일
편집: ANUSHA H P 2022년 1월 21일
yes sir, it was of grt help ,thankyou.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by