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.
Any help will be greatly appreciated.
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.
Below is the code i tried:
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',...)
since you have presented your problem domain to be CT-images. I have a good suggestion for you to extract the region of the brain tissues. There is a good assumption you can make.
A good assumption: The brain region has no bones(normal cases) other than the cranium, and, based on some properties of CTs, you can easily extract(or remove) the bone(the cranium in this case) by looking up the Hounsfield Scale (http://en.wikipedia.org/wiki/Hounsfield_scale)
0) To get the correct housefield units, you need three elements i) original pixel value ii) rescale slope iii) rescale intercept (all three can be located in the original dicom header and HU can the be computed based on our high school math knowledge: y=mx+b, since you have the intercept, the slope and the input value).
1) Once you know where the bone is, you just need to subtract your image to get anything bounded by the cranium.
2) And upon looking at your matlab codes, im sure you can perform step 1) to segment the right regoin from the leftovers.