├── 01-reading-writing-and-displaying-images.ipynb ├── A high-accuracy breast thermogram classifier based on mobile.pdf ├── Cancer_1.png ├── LICENSE ├── README.md ├── bandicam 2024-07-06 13-51-39-211.avi ├── p.pptx └── ppp.m /A high-accuracy breast thermogram classifier based on mobile.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdieslaminet/Machine_vision_and_image_processing/6d7b4b0c42aadc03b3ac673c2f49a022914cd5c9/A high-accuracy breast thermogram classifier based on mobile.pdf -------------------------------------------------------------------------------- /Cancer_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdieslaminet/Machine_vision_and_image_processing/6d7b4b0c42aadc03b3ac673c2f49a022914cd5c9/Cancer_1.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 mahdieslaminet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Machine_vision_and_image_processing 2 | Machine vision and image processing project 3 | Computervisionanddeeplearning(DL)haveachievedtheutmostprogressinviewingimagesatthe samelevelasthatofhumans[1]throughtheprocessoflearningsuchasinmedicalimageclassification [2–8].Supportedbypubliclyaccessibledatasets,computer-aidedworksbasedonimageprocessing andDLformedicalinterpretationhavebeenincreasinglyimproved. Inbreastcancerdetection,DLhas beenemployedtoclassifymedicalimagesofmammography[9,10],ultrasound[11],histopathological image[12–16],andthermography[17–22].Despitethehighaccuracyrateofthedeepneuralnetworks (NNs) applied to these modality images, the procedure for obtaining the images requires an individual to visit a specific hospital to perform the screening. It is a constraint for many people with limited mobility, such as those living far from the hospital or having other restrictions. Moreover,thermographyisanoninvasiveearlydetectorthatcanbepromotedasahandypre-cancer screeningtool[23].Earlydetectionmeansidentifyingbreastmasseswhentheyarestillinthetreatable stage with the least psychological and physical harm [24]. Therefore, developing and promoting of an early detector and self-screening tool for precancer are needed to prevent breast cancer and minimize the mortality rate. Additionally, WHO has recommended that women should take responsibility for their health by performing a breast self-examination. Preliminary research [25] also confirmed that screening, which is a systematic procedure to identify an individual with an abnormality suggestive of cancer [26], can reducetheincidencerate. Hence,ahandyscreeningtoolishighlyrequiredtoallowwomentoperform breast self-screening regularly. AhandyprecancerscreeningtoolbasedonthermographyandDLcanbeaneffectivetoolforbreast self-examination. Supported by the availability of publicly accessible datasets and the projection of 13.1 billion global mobile devices in 2023 [27], we believe a handy self-screening device can be achieved at a low cost. In addition, smartphones integrated with a thermal camera [28–30] have also been introduced into the market. Further, the performance of DL has inspired attempts to provide high-quality intelligent services on mobile devices. Nevertheless, our study indicated that the integration of DL and mobile devices is still at the preliminary stage. Thus, further work should be conducted by considering the fundamental requirements of a mobile application. Requirements for a mobile application: In deploying a DL model into a mobile application, we have to first decide the model inference location: on the cloud server or local mobile device [31]. Inference on the cloud server deploys a complexNNmodelandmaintainsthesimplicityofthemobileapplication. However,someissuesmay ariseasaresultofthismethod,suchasthelackofusers’dataprivacyandtheinabilityofsomepatients to use the application in areas with poor internet connection [32]. By contrast, the inference of a NN model on the local mobile device requires a less complex model that will allow the integration with a mobile application. For practical examples, Apple places a limit of 200 MB on the App Store [33], whereas Play Store requires that the compressed Android Package Kit be no more than 100 MB [34]. Since the intended mobile application is for breast cancer screening, a user’s image has to be confi- dential. In addition, regular screening should not depend on the internet connection. Thus, we recom- 4 | Mathematical Biosciences and Engineering Volume 19, Issue 2, 1304–1331. 5 | 1306 6 | mend that the inference (i.e., classification or prediction task) be localized within the mobile device. To enable on-device inference, the following requirements have to be met: 7 | • The input image should contain rich features. To obtain rich features from an image captured using a cell phone, the image should be preprocessed with a simple and efficient algorithm. • The mobile NN classifier should be deployable in the local mobile devices. • As the application is for medical purposes, it should have the highest accuracy rate. 8 | Considering the above requirements, we developed an efficient algorithm based on a convolutional neural network (CNN) model that can classify breast thermograms at a high accuracy rate. The classi- fier model breast cancer mobile network (BreaCNet), consists of a new segmentation algorithm and a mobile NN. The contributions of this study are as follows: 9 | • It highlights the mobile application requirements for breast thermogram classification. • It proposes a simple segmentation algorithm that suits the characteristics of breast thermograms to provide rich features. • It provides a good fit mobile CNN model based on ShuffleNet. • It introduces a high accuracy classifier model called BreaCNet consisting of the proposed seg- mentation algorithm and the mobile CNN model. • It proposes an implementation framework of the classifier model in a mobile application. 10 | The rest of this paper is organized as follows. Section 2 presents the related works, and Section 3 describes the materials and methods used in this work. BreaCNet’s development and its implemen- tation framework for a mobile application are clearly explained in Section 4,followedbythemodel performance discussion in Section 5.Finally,Section 6 concludes this study. 11 | 2. Relatedwork 12 | Numerous studies have been devoted to breast cancer detection based on thermography and DL since 2018 [23]. The works mostly used the image datasets from the database for mastology research (DMR)[35].TheexamplesofbreastthermogramsdownloadedfromDMRareshowninFigure1(a),(b) whichpresentsthenormalandabnormalthermogramsinRGBandgrayscale,respectively. Theabnor- malbreastthermogramwasobtainedfromapatientwithamedicalhistoryofmammographyandasign ofcanceron therightbreast. Thenormalandabnormalthermograms werenearlyindistinguishableby the naked eye. However, when the statistical feature analysis was employed, there was a significant difference found between the temperature distribution in the normal breast thermogram and that of the abnormal one. As illustrated in Figure 1(c),thehistogramofthenormalbreastshowedthatbothsidesofthe breast have similar temperature distributions and a lower mean temperature compared with that of the abnormal one Figure 1(d). Thus, the symmetrical characteristics of a breast thermogram can indicate thesignsofnormalityandabnormalityinbreasttissues[36]andcanbeanalternativemedicalimaging modality to detect breast cancer symptoms at an early stage. 13 | google drive link :https://drive.google.com/drive/folders/1iBlFFFa66U7WGxKwDQA8W28rcn83rkCu?usp=drive_link 14 | -------------------------------------------------------------------------------- /bandicam 2024-07-06 13-51-39-211.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdieslaminet/Machine_vision_and_image_processing/6d7b4b0c42aadc03b3ac673c2f49a022914cd5c9/bandicam 2024-07-06 13-51-39-211.avi -------------------------------------------------------------------------------- /p.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdieslaminet/Machine_vision_and_image_processing/6d7b4b0c42aadc03b3ac673c2f49a022914cd5c9/p.pptx -------------------------------------------------------------------------------- /ppp.m: -------------------------------------------------------------------------------- 1 | % Add the necessary paths for the toolbox 2 | addpath(genpath('C:Program FilesMATLABR2023btoolboximager')); 3 | 4 | % Open the image file 5 | uiopen('E:\dataset\Cancer Images\Cancer_1.png', 1); 6 | 7 | % Read the image 8 | I0 = imread('E:\dataset\Cancer Images\Cancer_1.png'); 9 | 10 | % Display the original image 11 | figure; 12 | imshow(I0); 13 | title('Original Image'); 14 | 15 | % Convert the RGB image to grayscale 16 | Ig = rgb2gray(I0); 17 | 18 | % Display the grayscale image 19 | figure; 20 | imshow(Ig); 21 | title('Grayscale Image'); 22 | 23 | % Apply Gaussian filtering to the grayscale image 24 | IG = imgaussfilt(Ig, 3); 25 | 26 | % Display the Gaussian filtered image 27 | figure; 28 | imshow(IG); 29 | title('Gaussian Filtered Image'); 30 | 31 | % Apply Sobel filtering to find edges in the image 32 | IE = edge(IG, 'Sobel'); 33 | 34 | % Display the edge-detected image 35 | figure; 36 | imshow(IE); 37 | title('Edge-Detected Image'); 38 | 39 | % Get the size of the edge-detected image 40 | [rows, cols] = size(IE); 41 | 42 | % Calculate the center of the image 43 | Ct = [round(rows/2), round(cols/2)]; 44 | 45 | % Plot the center point (this plot will not be very informative) 46 | figure; 47 | plot(Ct(2), Ct(1), 'ro'); % plot the center as a red dot 48 | title('Center Point'); 49 | axis([0 cols 0 rows]); 50 | set(gca, 'YDir', 'reverse'); 51 | 52 | % Find the boundaries of the edges 53 | leftBoundary = find(IE(:, 1) == 1, 1, 'first'); 54 | rightBoundary = find(IE(:, end) == 1, 1, 'first'); 55 | topBoundary = find(IE(end, :) == 1, 1, 'first'); 56 | 57 | % Compute the horizontal profile and find the point with maximum edges 58 | Hpp = sum(IE, 2); 59 | [~, idx] = max(Hpp); 60 | firstPoint = idx; 61 | 62 | % Find the bottom boundary points 63 | bottomBoundary = find(IE(:, end) == 1); 64 | secondPoint = bottomBoundary(1); 65 | thirdPoint = bottomBoundary(round(length(bottomBoundary)/2)); 66 | fourthPoint = bottomBoundary(end); 67 | 68 | % Store the segmented ROI (assuming you meant to store coordinates) 69 | IS = [firstPoint, secondPoint, thirdPoint, fourthPoint]; 70 | 71 | % Display the segmented points on the edge-detected image 72 | figure; 73 | imshow(IE); hold on; 74 | plot([1, cols], [topBoundary, topBoundary], 'r', 'LineWidth', 2); 75 | plot([1, cols], [bottomBoundary, bottomBoundary], 'b', 'LineWidth', 2); 76 | title('Segmented Points'); 77 | hold off; --------------------------------------------------------------------------------