The segmentation, detection and extraction of the infected tumor from Magnetic Resonance Imaging (MRI) images are the key concerns for radiologists or clinical experts. But it is tedious and time consuming and its accuracy depends on their experience only. This paper suggest a new methodology segmentation, recognition, classification and detection of different types of cancer cells from both MRI and RGB (Red, Green, Blue) images are performed using supervised learning, Convolutional Neural Network (CNN) and morphological operations. In this methodology, CNN is used to classify cancer types and semantic segmentation to segment cancer cells. The system trained using the pixel labeled the ground truth where every image labeled as cancerous and non-cancerous. The system trained with 70% images and validated and tested with the rest 30%. Finally, the segmented cancer region is extracted and its percentage area is calculated. The research examined on the MATLAB platform on MRI and RGB images of the infected cell of BreCaHAD dataset for breast cancer, SN-AM Dataset for leukemia, Lung and Colon Cancer Histopathological Images dataset for lung cancer and Brain MRI Images for Brain Tumor Detection dataset for brain cancer.