MATLAB: How do i segment the lung region after thresholding from a CXR image.I have provided the image below.

Image Processing Toolboximage segmentationlungsMATLAB

im=dicomread('C:\Users\user\Desktop\re.dcm');
im1=histeq(im);
imb = imbinarize(im1,'global');

Best Answer

You forgot to attach re.dcm.
Get rid of the histogram equalization call - that never helps. It's totally unnecessary.
See my lung segmentation routine, attached.