Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Extract part of Image inside specified boundary in MATLAB
    text
    copied!<p>I am new to MATLAB, i wanted to know that can i extract a part of image from inside of a specified boundary,based on distinguishing color(red boundary in my case),The function,first traces the boundary of the image,then it extracts that part of image which is inside that particular boundary. I have my image(image of human head) attached, i wanted to extract the brain part from the head, other part of image should be ignored. I tried to find edges,using the following code(it shows 1's for boundaries, and 0 for no boundary),but it showed only 0's.</p> <p>Any help will be greatly appreciated.</p> <p>P.S. image attached shows original image and image with boundary....the code will be working on the one with boundary and will extract the part of image lying inside that boundary.</p> <p>Below is the code i tried:</p> <pre><code>BW = edge(x) BW = edge(x,'sobel') BW = edge(x,'sobel',thresh) BW = edge(x,'sobel',thresh,direction) [BW,thresh] = edge(x,'sobel',...) BW = edge(x,'prewitt') BW = edge(x,'prewitt',thresh) BW = edge(x,'prewitt',thresh,direction) [BW,thresh] = edge(x,'prewitt',...) BW = edge(x,'roberts') BW = edge(x,'roberts',thresh) [BW,thresh] = edge(x,'roberts',...) BW = edge(x,'log') BW = edge(x,'log',thresh) BW = edge(x,'log',thresh,sigma) [BW,threshold] = edge(x,'log',...) BW = edge(x,'zerocross',thresh,h) [BW,thresh] = edge(x,'zerocross',...) BW = edge(x,'canny') BW = edge(x,'canny',thresh) BW = edge(x,'canny',thresh,sigma) [BW,threshold] = edge(x,'canny',...) </code></pre> <p><img src="https://i.stack.imgur.com/DCsoT.jpg" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload