MATLAB: How can i convert this binary image to black background image

color segmentationedge detectionimage processingImage Processing Toolboxorange part

i require the attached image in this format

Best Answer

vinith, this must be a class project or something from a text or else you're on the same project as Abdur Rahmaan, because I gave him complete code in this Answer http://www.mathworks.com/matlabcentral/answers/168170#answer_163355.
The way you're approaching it, with edge detection, is not the way I'd do it. I'd use color segmentation.