International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056
1.INTRODUCTION
Link it to the pattern you return to and identify Understandingpatterns.thepicture(imageunderstanding).
Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008

1PHD Student Dept. of Telecommunication, College of Electrical & Electronics Engineering, University of Aleppo, Aleppo, Syria
ThenCannyEdgealgorithmisusedtodetectandextractthe edgesoftherailway.Finally,theHoughtransformmethodis usedintheprocessingstageoftheextractedfeatures.Asa finalresult,therailroadtracksareobtainedclearlyandwith greataccuracyontheimage.Takingintoaccounttheslopeof each straight line and thus, the railways are revealed. The proposedimageprocessingmethodinthisresearchisvery
4Professor, Dept. of Telecommunication, College of Electrical & Electronics Engineering, University of Aleppo, Aleppo, Syria ***
Detect of Railroad using Image Processing and Applying it on Syrian Railways Razan Fattal1 , Abdel Mounem Alabdullah2 , Mohamad Najib Salaho3, Yahia Fareed4
©
Key Words: Computer Vision Curve Detection Image Processing RailwayDetection
Monitoringthestatusofrailways hasadirecteffectonthe safety of the track. This task is usually provided in a manpower based manner. However, there are some disadvantagesintermsofcostandgoodresults1.Inrecent years,technologicalprogresshasledtothedevelopmentof manpower basedmethodsinthisfield. Withthelowercosts forcomputersandelectronicdevicesandthedevelopmentof software technologies, railway monitoring techniques providemoreeffectiveandreliableresults.Therearemany studies in the field of railway computer vision monitoring2,3.image processing is a branch of computer scienceInformatics,concernedwithperformingoperations on images with the aim of improving them according to specificcriteriaorextractingsomeinformationfromthem. Rail transport is one of the commonly used modes of transport.Comparedtoothermodesoftransportation,rail traffic is very important. Multiple locomotives run continuously on one or two lines4. In spite of various and variousresearcheffortsinthisfield,therearestilldifficulties regarding images processing of complex scenes with changing lighting conditions, low contrast, blurry backgrounds5.Otherdifficultiesexistwhenitcomestodetect lines Rail road using image processing and recognition systems6.Mostresearchfocusedonstudyingtwodirections: thefirstdirectiondependsontodistinguishtherailwaylines inordertomonitortheirconditions7.Theseconddirection depends ontheuseof digital image processingtechniques and computer vision in railway networks within smart Assystems8.inanydigitalimageprocessingsystem,choosingthecolor spaceforprocessingconstitutesisthemostimportantstage. Inthisstudy,anewmethodbasedonimageprocessingusing Python and OpenCV environment is presented to detect railways.Theproposedmethodconsistsofthreemainparts includingpreprocessingandfeatureextraction.Atthestart, traditionalimageprocessingmethodswereused,whichare consisting of six successive stages: get the image (image acquisition)Byalightsensor(forexample,acamera,alaser sensor,etc.). pretreatment(pre processing)Suchasfiltering the image from noise or converting it to a binary image cropping image (segmentation) To separate important information (eg any object in the image) from the background. Feature extraction (features extraction) or Featuresattributes.rating
3Professor, Dept. of Telecommunication, College of Electrical & Electronics Engineering, University of Aleppo, Aleppo, Syria
2Professor, Dept. of Telecommunication, College of Electrical & Electronics Engineering, University of Aleppo, Aleppo, Syria
Certified Journal | Page912
Abstract Recently, the use of computer vision has increased in all fields. It helps in detecting objects, and faults in railway transport systems. It can also assist in monitoring that status of the railway using data obtained by cameras and smart sensors. Given the importance of rail transport in general, and in Syria in particular, efforts are being made to develop monitoring systems to allow monitoring the railway, especially after the Syrian railway network was sabotaged. In this research, a database was adopted to perform digital image processing operations, which consists of real video clips that were captured through a camera installed at the front of the locomotive for one of the railways in Syria, in order to discover, identify and monitor the two lines of the railway network. A series of digital image processing applications have been used on images clipped from a video file, and the rail line bends have been detected under various lighting conditions. The experimental results have been analyzed and it has been shown that the proposed method has accurate and effective results.
Trinhandotherssuggestedanintegrationandoptimization method failuremethod,identifyproposedwithmultiplesensorsforrailwayinspection14.Inthemethod,distancemeasuringdeviceswereusedtorailwayobjectswithmultiplecameras.Withthisfailuressuchaspartsdefects,alignment,surfaceandinclinationwereidentifiedduringrailinspection.
Computer vision based railway monitoring methods are possibleusingdataobtainedwiththehelpofcomputersand thedigitalprocessingofthecapturedimages.Thisresearch proposes to monitor the state of the railway visually by meansofacameraplacedonthetop frontofthetrain.The trackonwhichthetrainisrunning,andthepicturesofthe neighboring railways are captured. Edge and feature extractionareappliedonthecapturedimagestoidentifythe Therails.contributionofthisresearchliesinrestoringthesafetyof the traffic of the Syrian railway network, because of the globalandlocalimportanceofrailtransportation.Thiswill helprunningfreightandpassengertrainstothemaximum capacityovertheserailways.Thevideoimageprocessorisa combination of methods that are extracted to process the data provided by the imaging sensor which is a camera placedatthefront topofthetrain15
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 © 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified

2. Materials and Methods:
Theoperatorsetsseveralrailroaddetectionareaswithinthe fieldofviewforthecamera.Then,real timeimageprocessing algorithmsareappliedtotheseregionsinordertoextractthe required information, such as the path of the two railway tracks and the curves of the track. The advantages of this methodarethatthecameraismountedtothefrontofthe locomotive rather than to the road. In this way, detection defectscausedbyshadows,weatherandreflectionscanbe overcome.
2.3 Search method: The captured images of the railway are processed using PythonandOpenCVlibrary...Eachvideoframeisconverted intoaseriesofimages.Theimagesaresentthroughasetof filtersandconvertthemintodigitalimages(frames)Inorder tooptimallydeterminethetworailwaylineswiththebends ofthelinesthroughasetofstages,butatfirstasetofpre treatmentoperationsiscarriedout.
fast,asitwasfoundthattheproposedmethodgivesquick andsuccessfulresults.
2.2 Search objective: Applyingreal timeimageprocessingalgorithmsusingPython andOpenCVlibrarytodiscoverfailsinthetworailwaysa movinglocomotiveusingcamerafixedonthefront topofit. Thisresearchcomes fromtherequirementsoftherailway realityintheSyrianRailwaysGeneralCorporationtoachieve the safety of rail traffic. This is important to guarantee reliable rail transportation of shipping goods and fuel, especially the Syrian Railways General Corporation is carryingamassivereconstructionandrehabilitationofthe railways,afterthehugedamagetheysufferedfrombecause ofthecurrentconflictincountry.Hencetheimportanceof thisresearchistoachieveoptimalcontroloftherailwaywith trackingbends,throughthedigital imageprocessingusing realtimecamera.
2.4 Initialization: In order to reduce the human input and the number of parametersrequired,aninitializationprocessiscarriedout for each train. After that the system will keep the configuration file and update it automatically. The only human intervention required during this process is to determine the gap between the rails and the left rail start position,asexplainedbelow,atwhichpointatriggerisused.
2.1 Research importance:
2.5 Determining the starting position of the rails: The starting location of the rails should be determined to create windows from the bottom to the top. This method assumesthatthegapbetweentherailsisfixed.Tomakeit workinrealtime,thealgorithmmustbecomelinear,andto dothat,aslidingpairofwindowshasbeencreated,sothat the gap between windowsis the sameas thegapbetween barsandisreadfromtheconfigurationfile.
1.1 Previous studies: Manystudiesexisttodetectthetwo linerailways.Karakose andothersproposedawayofseeingtherailwaytodetermine thelinesandtheirbends1.Inthisstudy,acomputer based visualrailconditionmonitoringisproposed.Bymeansofa cameraplacedontopofthetraintherailthatthetrainison and the neighbor rail images are taken. Singha and others explorethepossibilitiesofcomputervision basedmonitoring through drone imagery. The experimental results ensured that the proposed method provide high reliability and accuracy10. The discoveryof the railwaycomponentswas carriedoutasin11,12. The researchers here detected failures in real time on the railwaysurfacebydevelopingacontactlessmethodbasedon image processing. The railway surface was detected by extractingaportionoftherailwayimages.Thefaultsofthe detected rod surfaces were determined using the contrast enhancementmethod.Thismethodonlyallowsdetectingthe surfaceoftherailandidentifyingsurfacefaults13.
Journal | Page913
The novelty in this research lies in discovering the two railways in a clear way, with the focus on detecting bends duringthemovementofthetrain,inrealtime,byinstallinga trackingcameraontheheadofthetrain.
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 © 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page914

2.6 Image processing steps: Imagesoftherailwaycapturedviathecameraareprocessed According to the stages shown in Fig 2. The stages are explainedinmoredetailsinthecomingsections.
Frame Size Adjustment (Resize): This modification is done using the. method cv2.resize() Where the image size can be determined manually or by scalingfactor Image stack: It is used to serialize and deserialize the structureofaPythonobject,sothatanyobjectcanbestored inPythonandsavedtodisk.Thestackfirstrenderstheobject asastringbeforewritingittothefile,byconvertingittoa stringof Distortioncharacters.processing
Processingtheimageingraylevel:Asetofoperationswere performedontheimage,asshowninthefollowingFigure3 VideoframesareconvertedfromRGBtograyscalebecause processingasinglechannelimageisfasterthanprocessinga three channelcolorimage,especiallymostofthesignificant informationisintheluminancepartoftheimage,notinthe chrominanceparts.

Fig 1:showstheworkflowofprocessingthecaptured imagesusingthecamerafixedattheheadofthe locomotive

Fig 3:Therailwayimageafterconvertingtograyscale Noise Reduction: Noise can create false edges, so before movingforward,itisnecessarytoperformimagesmoothing. ThefilterusedhereisGaussian.Figure4showstheimage afterapplyingGaussianfilter.
Figure2showsexampleofthecapturedimagethatisready tobeprocessedfromSyrianRailways: Fig 2:Basicimagecapturedfromthecamerafixedonthe frontofSyrianlocomotive
Causedbythecamera:Somecameras causesignificantimagedistortion.Therearetwomaintypes ofdistortion,radialdistortionandtransversedistortion.

Erosion process: Thisprocessisusedtosmooththefront surfacelimits.Fig7showstheimageafterapplyingErosion process.
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 © 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page915

Determine the region of interest (ROI): This stage only takeintoconsiderationtheareacoveredbytheroadcorridor. A mask with the same dimensions of the railway image is created.AbitwiseANDoperationisperformedBetweeneach pixel of the image and the mask. finally hides the image withoutthetwotrainlinesandshowstheregionofinterest tracedbythepolygonalcontourofthemask.Herethemaskis usedasatriangle,asshowninFigure6.
Stretching Dilation process: It is the opposite process corrosionarea.Usuallyafterapplyingtheerosionprocessto removethenoiseofthewhiteareainthepicture,thebody areaisdecreased.Forthaterosionprocessisfollowedbya stretching process to increase the area and restore its eroded parts. As a result of converting the color image to gray level and then applying the Canny algorithm and determining the region of interest, unfilled voids in the railwaylineshaveappeared.Forthattheuseoferosionand expansionfiltersareessentialtogetamoreaccurateresult, asshowninFigure8.
Fig 6: Therailwayimageafterextractingaregionof interest
Applying edge detection using Canny algorithm edge Detector: Edge detection using Canny is a famous algorithm for defining edges. Figure 5 shows the image after applying Cannymethodforedgedetection.



Fig 4:TherailwayimageafterapplyingGaussianfilter

Fig 5:TherailwayimageafterapplyingCannyEdge Detector.
Fig 7: Therailwayimageafterapplyingerosionoperation
Bit level operations (Bitwise operation): It includes operationsNOT,XOR,OR,AND.Theseoperationsarevery useful when determining which part of the image is not rectangularandheretheimageswerecombinedusingthe instructionBitwiseOR. Perspective adjustment: perspective transformation standardizationscaling:Itistheprocessofdeterminingthe size of the image dimensions, through the function cv2.resize.Obtainingtherequiredcurvature:herethe basicimageis used with a curvature point from the left and a curvature point from the right according to the following function Figurepolyfit
Certified Journal | Page916
9:Thefinalresult.
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 © 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008

Fig 9:Thefinalresult. Discuss the results: Usingthestagesdescribedabove,onimagescapturedusing thecameraatthefrontofthemovinglocomotiveinrealtime shows that the proposed image processing method can detecttwo railroadtrackswithgreataccuracy.Thestages andstepsthatareperformed,andtheresultsoftheimage processing show that the image obtained in this way is characterizedbygreatclarityandhighaccuracy,inaddition tothespeedofimageprocessinginthispapercomparedto othermethodsmentionedinthepreviousstudies. Throughtheexperimentalresultsinthisresearchtomonitor andidentifythetworailwaytracks,thetworailwaytracks were detected and the railway surface was monitored. Compared with similar studies, it's been found that no methodhasbeendevelopedtodetectrailwaycomponents andmonitorrailwaysurfacefailuresandtheconditionofthe railway line in real time and during the movement of the Thelocomotive.methodproposedinthisresearchhasbeencompared withsomerelatedpreviousstudiesasshowntable1. Table 1: Comparisonoftheproposedimageprocessing methodwithotherstudies. processingtime(ms)deviationstandard(ms)sizeImage(pixel) methodSuggestedforsearching1252.1480×360 Ref[11]1064.62.3640*480

Fig 8: Therailwayimageafterapplyingdilation operation. Convert the image to color space HSV (hue, saturation, value): Therearemanyavailablemethodstoconvertagrey imagetocolorspaces.Inthispaper,theimageisconverted to gray for processing, then converted to HSV color space (hue,saturation,value).

Authors' declaration AlltheFiguresandTablesinthemanuscriptaremineours.
ACKNOWLEDGEMENT
Future prospects and suggestions: This research relied on image processing techniques to detect railways. Techniques such as AI and deep learning techniquescanbeusedtoprocesstheimagefromamoving videoinrealtimetoimprovetheresultsfurtheranddetect obstaclesandmalfunctionspossibleacquisitionofthetwo railwaylines.
3. CONCLUSIONS
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 © 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page917

Fromtheprevioustable,thecomponentsoftherailway,the surfaceoftherailwayanditsdirectionontherailwaywere revealed.Thedimensionsandprocessingtimeoftheimage were given to discover the railway track. Looking at the processing time and image dimensions for the references mentioned in table 1, it’s been found that the proposed method is successful and achieved a high speed of image processingandhighimageaccuracyandclarity.
Ref[12]2474.1512*832 Ref[13]1202.5320*240 Ref[14]1001.7220*220
This paper considers monitoring the conditions of Syrian railwaysinrealtimeusingcameramountedatthefrontofa moving locomotive. This study proposes a new method of imageprocessingtodetectthetworailwaylines,whichthey are the most important components of the railway. In the proposedmethodfordiscoveringrailwaycomponents,edge extractionwasperformedonimagescapturedfromacamera mountedat thefront ofa movinglocomotive. The straight lines in the picture were classified and the image was processedusingPythonafterthevideowascutintoframes according to gray level image processing techniques, and thenHSVthetwostagesarecomplementarytoeachother, andanadjustmentprocesshasbeenmadetotheimagesize toobtainthefinalversionoftheimage. Thebenefitoftheproposedresearchmethod,isitcanbe appliedtoavideoclipandnotonlyastaticimage.Inaddition tothepossibilityofdiscoveringcurvesandthusdiscovering theentirerailsoftherailwayandidentifyingthemclearly andaccuratelyalongthetraintrackevenwiththepresence ofcurves.Theotherimportantpointofthisresearchisthat thereisnoneedtoconsidertheconditionsofenvironment brightnessanditsimpactonimageprocessing.Theresults showthattheproposedmethodexceedsothermethodsin terms of speed of processing and accuracy. The proposed methodisaneffectivealternativeforrailways.
EthicalClearance:TheprojectwasapprovedbyUniversity ofAleppo REFERENCES [1].KarakoseM,YamanO,BayginM,MuratK,AkinE.ANew ComputerVisionBasedMethodforRailTrackDetectionand Fault Diagnosis in Railways . International Journal of Mechanical Engineering and Robotics Research .2017 JAN 1;6(1). [2].ParlakyıldızS,GencogluMT,CengizMS.ANALYSISOF FAILURE DETECTION AND VISIBILITY CRITERIA IN PANTOGRAPH CATENARY INTERACTION. Light & Engineering.2020;28(6):127 135. [3].KarakoseM,YamanO,MuratK,AkinE.ANewApproach forConditionMonitoringandDetectionofRailComponents and Rail Track in Railway. International Journal of ComputationalIntelligenceSystems.2018;11:830 845. [4]. SANTUR Y, KARAKOSE M, Akın E. An adaptive fault diagnosis approach using pipeline implementation for railwayinspection.TurkishJournalofElectricalEngineering &ComputerSciences.2018;26:987 998. [5].MathWorks,(2017),"ConvertfromYCbCrtoRGBColor Space". approachimplementationInformationimagery.based2021.Technologies4th[8].ApplicationsIn2017processing[7].Engineering.analysis.recognitionDomain=www.mathworks.comycbcrttps://www.mathworks.com/help/images/convert[Online].Available:fromtorgbcolorspace.html?requested[6].NugrohoHA,GoratamaRD,FrannitaEL.Faceinfourtypesofcolourspace:aperformanceIOPConferenceSeries:MaterialsScienceand2021.OnatE.FPGAimplementationofrealtimevideosignalusingSobel,Robert,PrewittandLaplacianfilters.25thSignalProcessingandCommunicationsConference(SIU)2017May15(pp.14).IEEE.QinY,JiaL,LiuB,LiuZ,DiaoL,AnM.ProceedingsoftheInternationalConferenceonElectricalandInformationforRailTransportation(EITRT).Springer.[9].SinghaAK,SwarupaA,AgarwalbA,SinghD.VisionrailtrackextractionandmonitoringthroughdroneTheKoreanInstituteofCommunicationsandSciences(KICS).2019.[11].KaraköseM,YamanO,ErhanAK.Realtimeforfaultdiagnosisandconditionmonitoringusingimageprocessinginrailwayswitches.
ThisworkwasapprovedbyDeptofTelecommunication andComputerscienceuniversityofAleppo
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 © 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified

International Journal of Applied Mathematics Electronics andComputers.2016Sep1(SpecialIssue 1):307 13. [12].XiaY,XieF,JiangZ.Brokenrailwayfastenerdetection based on adaboost algorithm. In2010 International ConferenceonOptoelectronicsandImageProcessing2010 Nov11(Vol.1,pp.313 316).IEEE. [13]. Li Q, Ren S. A real time visual inspection system for discretesurfacedefectsofrailheads.IEEETransactionson Instrumentation and Measurement. 2012 Feb 10;61(8):2189 99. [14]. Trinh H, Haas N, Pankanti S. Multisensor evidence integration and optimization in rail inspection. InProceedings of the 21st International Conference on PatternRecognition(ICPR2012)2012Nov11(pp.886 889). [15].IEEE.Tastimur C, Karakose M, Akin E. Image processing based level crossing detection and foreign objects recognition approach in railways. International Journal of Applied Mathematics Electronics and Computers. 2017 Aug(SpecialIssue 1):19 23.
Journal | Page918