How do you use roifill if the mask you have specifies all the pixels you want replaced

조회 수: 1 (최근 30일)
I would like to use roifill to replace pixels in an image. I know exactly which pixels I want replaced so I can specify a mask in the second argument. But because I have specified a region with edges that are within the region I want replaced roifill does nothing (it's using these edge values to estimate the interior). I really want roifill to take pixels just outside of that masked region and map them to all values within. Is there anyway to identify all pixels 'just outside of' my mask region and define an 'augmented' mask?

채택된 답변

Sean de Wolski
Sean de Wolski 2013년 5월 9일
You could dilate the mask to make it bigger or use the distance transform to identify pixels within n pixels of your mask.
doc imdilate
doc bwdist
  댓글 수: 1
Image Analyst
Image Analyst 2013년 5월 29일
I have found that also. You need to dilate so the pixels it smears inwards are taken from outside your binary mask region. Otherwise you're just smearing in zeros.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by