PCL extracts point cloud boundary contour-AC method, plane contour

1. Overview PCL point cloud boundary feature detection (with complete code C++)_pcl calculates point cloud feature values_McQueen_LT’s blog-CSDN blog In terms of point cloud boundary feature detection (grid model boundary feature detection is already a deterministic problem, see grid model boundary detection), there is a method in PCL for point cloud boundaries that can be […]

Decompress zip, tar, rar, 7z, extract pictures in tif, pdf

1. Decompression interface public interface Decompress { //curFilePreDir, if the compressed package in the compressed package has the same name as the outer folder or file, problems will occur. Adding the directory prefix of the upper layer can avoid it. public<MulpartFile> decompress(File file, String curFilePredir); } 2. The decompression class implements the Decompress interface public […]

[Fault Diagnosis Analysis] Rolling bearing fault diagnosis feature extraction with Matlab code

?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously. For code acquisition, paper reproduction and scientific research simulation cooperation, please send a private message. Personal homepage: Matlab Research Studio Personal credo: Investigate things to gain knowledge. For more complete Matlab code and simulation customization […]

Matlab batch extracts image feature vectors

Recently, the matlab digital image processing course requires batch feature extraction of thousands of training set and test set images as input to SVM. So you can use matlab to extract image feature vectors in batches and save them for subsequent use. Batch extraction function: % function return parameters % Category column vector Categorys, and […]

Matlab implementation: image edge extraction

1. Edge extraction algorithm Method 1: First-order differential operator Sobel operator The Sobel operator detection method has a better processing effect on images with grayscale gradients and more noise. The Sobel operator is not very accurate in edge positioning, and the edge of the image is more than one pixel. Roberts operator The Roberts operator […]

[Fault Diagnosis Analysis] Rolling bearing fault diagnosis feature extraction with Matlab code

?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously. For code acquisition, paper reproduction and scientific research simulation cooperation, please send a private message. Personal homepage: Matlab Research Studio Personal credo: Investigate things to gain knowledge. For more complete Matlab code and simulation customization […]

[Record] PDF|Chinese and English PDF scanned version directory extraction (1, QQ+GPT)

need: 1) Quickly extract table of contents from PDF; 2) Don’t want to download any software. Article directory 1. Directly export the directory using existing commonly used software 1 (recommendation index☆) QQ OCR text recognition 2 (recommendation index 0 stars) GPT4 image recognition 3 (recommended index 0 stars) GPT4 AI PDF plug-in 4 (recommended index […]

Target detection (2) Feature extraction of traditional target detection and recognition – Viola Jones detection principle based on Haar-like features

TableofContents Introduction integralplot Trainoptimalweakclassifier Trainastrongclassifier strongclassifier Cascadeclassifier Introduction TheViolaJonesdetectorconsistsofthreecoresteps,namelyHaar-likefeatureandintegralmap,Adaboostclassifierandcascadeclassifier.Supposethatduringtargetdetection,suchasub-windowisneededtocontinuouslyslideandmoveintheimagetobedetected.Everytimethesub-windowreachesaposition,thecharacteristicsoftheareawillbecalculated,andthenthetrainedcascadeclassifierwillbeusedtoFeaturesarefiltered,andaslongasthefeaturepassesthescreeningofallstrongclassifiers,theareaisdeterminedtobethetargetarea. AsshowninFigure9.3,thereare5differentHaar-likefeatureoperators.Assumethatthetotalgrayvalueoftheblackareaineachpictureis?,andthetotalgrayvalueofthewhiteareais.Theresultobtainedis:Haar-likeeigenvaluesofthesub-windowarea. Figure9.3haarfeatures Therectangularfeaturecanbelocatedatanypositionintheimagewindow,anditssizecanalsobechangedatwill.Therefore,therectangularfeaturevalueisdeterminedbythethreefactorsofhaarfeatureoperatorcategory,rectangularpositionandrectangularsize.Therefore,changesincategory,size,andposition,sothatsmallerpictureswillalsocontainmanyrectangularfeatures. Takinga24×24windowasanexample,fivedifferentHaar-likefeatureoperatorsareusedforcalculationinFigure9.3.ThenumberofeigenvaluesofthefiveHaar-likefeatureoperatorsare:43200,43200,27600,27600,20736,atotalof160381.Theimagewindowof24×24sizealonehasmorethan160,000featurevalues.Now,wearefacedwithtwoproblems: Facedwithsomanyeigenvalues,howtooptimizecalculationsandreducetheamountofcalculations? Therearetoomanyeigenvalues.Theremustbesomeeigenvaluesthatarebetteratidentifyingpositivesamplesandnegativesamples,andsomethatarenotgoodatdistinguishingpositivesamplesfromnegativesamples.Sample.Sohowtofindthesegood,excellentfeatures,thatis,theoptimalweakclassifier. IntegralChart First,tosolvethefirstproblem,youneedtousetheintegralmap.Foragrayscaleimage,thevalueofanypointintheintegralmapisthegrayscaleofallpointsintherectangularareaformedbythispointfromtheupperleftcorneroftheoriginalimage.Thesumofthevalues,asshowninFigure9.4:theleftpictureistheoriginalimage,therightpictureistheintegralimage,the3rdrowand4thcolumnintheintegralimagearethepixelsumoftheyellowboxareaintheoriginalimage,the5thintheintegralimageThesecondcolumnoftherowisthepixelsumofthepurpleboxareaintheoriginalimage. Figure9.4Integralplot TheformulashowninFigure9.4canconstructanintegralgraph,butgenerallythefollowingformulaisusedtoconstructanintegralgraph: representsthecumulativesumofthepixelvaluesofthefirstjrowoftheimagei,initialized Userepresentsanintegralimage,initialized Scantheimagelinebylineandcalculatetheaccumulationofeachpixelii,jand,thecalculationmethodsareasfollows: Scantheimageonce.Whenthepixelinthelowerrightcorneroftheimageisreached,theintegralmapii(i,j)iscompleted.Howtocalculatethesumofpixelsinacertainrectangularareaoftheimagethroughtheintegralmap? AsshowninFigure9.5:Intheoriginalimage,therearefourareasA,B,C,andD,wherea,b,c,anddrepresentthefourverticesoftheDarea.HowtocalculatetheintegraldiagramofareaD? Figure9.5Imagearea Use,,,representa,binFigure9.5,respectively.Theintegralvaluesofthefourpointscandd.Usethefollowingequation9.3tocalculatethetotalgrayvalueofthepixelsinareaD: Accordingtotheabovetheory,itcanbefoundthataftertheintroductionofintegralmaptechnology,theHaar-likerectangularfeaturevalueofanimageisonlyaffectedbythevalueofitscorrespondingintegralmap,andthechangeofthecoordinatesoftheimage’spositionhasnocorrelationwithitsvalue.Inthisway,thetimetakentocalculatefeaturevaluescanbeshortenedwhencalculatingrectangularfeatures. Traintheoptimalweakclassifier Nowlet’ssolvethesecondproblem.Therearetoomanyfeatures,soweneedtoscreenthefeaturesandselecttheoptimalweakclassifier.TheinitialweakclassifiermaybejustabasicHaar-likefeature.ItcalculatestheHaar-likefeaturevalueoftheinputimageandcomparesitwiththefeaturevalueoftheinitialweakclassifiertodeterminewhethertheinputimageisaface.However,thisweakclassifierItistoocrudeandmaynotbebetterthanrandomjudgment.Theincubationofweakclassifiersistotrainweakclassifierstobetheoptimalclassifier.Notethattheoptimalclassifierisnotastrongclassifier,butaweakclassifierwitharelativelylowerror.,trainingaweakclassifierisactuallytheprocessofsettinguptheclassifier.Asforhowtosetuptheclassifierandwhattoset,let’sfirstlookatthemathematicalstructureoftheweakclassifierasshowninEquation9.4: Theparameterxisthecharacteristicwindow,prepresentsthedifferentdirectionsoftheinequality,withvaluesof1and-1,andgistherectangularwindow.ThecorrespondingHaar-likefeaturevalue,θ,isthejudgmentthresholdoftheweakclassifier. ThemostbasicweakclassifieronlycontainsoneHaar-likefeature,whichmeansthatthedecisiontreehasonlyonelayer,calledastump.Tocomparethefeaturevaluesoftheinputimageandtheweakclassifierfeatures,athresholdisneeded.Whenthefeaturevalueoftheinputimageisgreaterthanthethreshold,itisdeterminedtobeaface.Theprocessoftrainingtheoptimalweakclassifierisactuallytofindasuitableclassifierthresholdsothattheclassifierhasthelowestjudgmenterrorforallsamples.Thespecificoperationprocessisasfollows: Findtheoptimalthresholdthatminimizestheclassificationerror.Withthisthreshold,thefirstoptimalweakclassifierisborn,ThebirthofthefirstoptimalweakclassifiermeansthatthebestHaar-likefeaturevaluehasbeenscreenedout. Trainstrongclassifier Weakclassificationisonlyaclassifierwithacertainclassificationability,anditsratiocannotmeetthebasicrequirementsforaclassifier,soitneedstobefurtherstrengthenedtobuildastrongclassifierbasedontheweakclassifier.Thespecifictrainingstepsareasfollows: Initializethesampletrainingset Trainingsampleset(x1,y1),…,(xn,yn),whereyi∈0,1,yiisthepositiveandnegativesampleidentifier,1ispositive,otherwiseitisnegative. Initializesampleweightsbasedonthenumberofpositiveandnegativesamples Theinitialweightofthepositivesampleis,theinitialweightofthenegativesampleis,wherem,listhetotalnumberoffacesamplesandthetotalnumberofnon-facesamples,andthetotalnumberofallsamplesisnem>,andsatisfytheconditionofn=m+l,isusedtorepresenttheweight,wheretreferstothetthalgorithmiteration,jreferstothejthoneinthetrainingsample Iterativetrainingofweakclassifiers StrongClassifier Thefinalstrongclassifierisrecordedas: Amongthem,indicatesthemaximumnumberoftrainingtimes. CascadeClassifier AstrongclassifiercanbeconstructedthroughthetrainingoftheaboveAdaBoostalgorithm,buttheaccuracyofsuchaclassifierstillneedstobeimproved,sothestrongclassifierisnotthefinalstructureoftheclassifier.Inordertomaketheaccuracyanddetectionefficiencyoftheclassifierbetter,youcanUsethecascademethodtocombinestrongclassifiersintoacascadeclassifier. Figure9.6Cascadeclassifier Infact,thepurposeoftrainingacascadeclassifieristomakedetectionmoreaccurate.ThedetectionsystemoftheHaarclassifiertakesanimageinrealityasinput,andthenperformsmulti-regionandmulti-scaledetectionontheimage.Theso-calledmulti-Regionistodividetheimageintomultipleblocksanddetecteachblock. Sincethephotosusedfortrainingareonlysmallimagesofabout20*20,multi-scaledetectionisrequiredforlargefaces.Multi-scaledetectionmechanismsgenerallyhavetwostrategies.Oneisnottochangethesizeofthesearchwindow.However,bycontinuouslyscalingtheimage,thismethodrequiresthecalculationofregionalfeaturevaluesforeachscaledimage,whichisnotefficient. Anothermethodistocontinuouslyinitializethesearchwindowsizetotheimagesizeduringtraining,continuouslyexpandthesearchwindow,andperformsearches,whichsolvesthedisadvantagesofthefirstmethod.Duringtheprocessofareaenlargement,thesamefacewillbedetectedmultipletimes,whichrequiresthemergingofareas.Nomatterwhichsearchmethodisused,alargenumberofsub-windowswillbeoutputfortheinputimage.Thesesub-windowswillbecontinuouslyfiltered,discardedorpassedbythefirstnodethroughthefilteringcascadeclassifier,asshowninFigure9.6. UsetheViolaJonesclassifierprovidedbyopencvtodetectfacesandeyes.Theimplementationcodeisasfollows: importcv2 #Loadclassifier eye_cascade=cv2.CascadeClassifier(cv2.data.haarcascades,’haarcascade_eye.xml’) img=cv2.imread(‘image/lenna.bmp’)#Loaddetectionimages gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) #Performtargetdetectiononimagesthroughtheclassifier […]

[Fault Diagnosis Analysis] Rolling bearing fault diagnosis feature extraction with Matlab code

?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously. For code acquisition, paper reproduction and scientific research simulation cooperation, please send a private message. Personal homepage: Matlab Research Studio Personal credo: Investigate things to gain knowledge. For more complete Matlab code and simulation customization […]