nan outside polygon ones inside

2 views (last 30 days)
zawaiter
zawaiter on 9 Feb 2012
i have the vertices and facec of a figure i want to set all area outside this boundaries to nan and save the image matrix.plz some help i am still having a problem with this issue ,i have wrote two codes one depending on what kevin explained and a second one depending on image analyst explanation,here what they recommend. http://www.mathworks.cn/matlabcentral/answers/27570-how-to-set-nan-to-areas-outsid-a-polygon-on-the-image. in the first code i noticed some ones in one side outside the head area and some zeros in the other side inside the head area, as if the mask is shifted to one side. i guess the solution may be in the part you mentioned about getting the distance and make a thresholding but i don’t know how to do it. the second code recommended by image analyst, fit the head boundaries very well although there is a lot of zeros inside the head area. i believe i might made a little mistake here or there but i am not able to locate it and fix it.i wish you allow me to send the codes and data to you and take look at them , i will be so grateful . thanks again

Answers (0)

Community Treasure Hunt

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

Start Hunting!