├── .classpath ├── .gitignore ├── .gradle ├── 4.10.3 │ ├── fileChanges │ │ └── last-build.bin │ ├── fileHashes │ │ └── fileHashes.bin │ └── gc.properties ├── vcs-1 │ └── gc.properties └── vcsWorkingDirs │ └── gc.properties ├── .project ├── .settings ├── org.eclipse.buildship.core.prefs ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── 2019021301.png ├── DP ├── MD5Processor │ ├── StringUtil.java │ ├── Token.java │ ├── TokenUtil.java │ ├── Usr.java │ └── UsrToken.java ├── NLPProcessor │ ├── DETA_ANN_HMM.java │ ├── DETA_DNN.java │ ├── StopSymbol.java │ └── TranditionChinese.java ├── cacheProcessor │ ├── Cache.java │ └── CacheManager.java ├── imageProcessor │ ├── CheckRange.java │ ├── Closing.java │ ├── ConvexHull.java │ ├── Dilation.java │ ├── Emboss.java │ ├── Erosion.java │ ├── GetMean.java │ ├── GroupOperator.java │ ├── Guassian.java │ ├── HitAndMiss.java │ ├── HoughTransform.java │ ├── Laplacian.java │ ├── LayerWiseRelevencePropagation.java │ ├── Mask.java │ ├── Median.java │ ├── Opening.java │ ├── PrintMoments.java │ ├── ReadWritePng.java │ ├── Reflection.java │ ├── RegionGet.java │ ├── Sobel.java │ ├── Strech.java │ └── Threshold.java ├── mapProcessor │ └── VtoV.java ├── matrixProcessor │ ├── AnnSummingPath.java │ └── CnnMeasure.java ├── movieProcessor │ ├── AdataFrame.java │ ├── Export.java │ ├── Header.java │ ├── JavaCVReadAVI.java │ ├── LYGFileIO.java │ ├── LYGPlayer.java │ ├── MdataFrame.java │ └── WAVtoLYG.java ├── org │ └── LYG │ │ └── GUI │ │ └── platForm │ │ ├── UnicornJSplitPane.java │ │ ├── UnicornScrollBarUI.java │ │ ├── UnicornSplitPaneUI.java │ │ ├── UnicornTreeCellRenderer.java │ │ └── UnicornTreeUI.java ├── searchProcessor │ ├── BinarySearch.java │ ├── BreadthRun.java │ ├── BreadthTreeSearch.java │ ├── Demo.java │ ├── DepthRun.java │ ├── DepthTreeSearch.java │ ├── LinerSearch.java │ ├── Node.java │ ├── PreorderRun.java │ ├── PreorderTreeSearch.java │ └── RandomSearch.java ├── sortProcessor │ ├── BBSort.java │ ├── BTreeSort.java │ ├── BinarySort.java │ ├── Compare.java │ ├── Demo.java │ ├── Heap_1D_Sort.java │ ├── Heap_2D_Sort.java │ ├── InsertionSort.java │ ├── LYGSort.java │ ├── Leaf.java │ ├── LinkSort.java │ ├── MergeSort.java │ ├── OTreeSort.java │ ├── OrderEvenSort.java │ ├── Quick_1D_Sort.java │ ├── Quick_2D_Sort.java │ ├── Quick_3D_Sort.java │ ├── Quick_4D_Sort.java │ ├── Quick_5D_Sort.java │ ├── Quick_6D_luoyaoguang_Sort.java │ ├── Quick_7D_Sort.java │ ├── Quick_Luoyaoguang_1D.java │ ├── Quick_Luoyaoguang_2D.java │ ├── Quick_Luoyaoguang_3D.java │ ├── Quick_Luoyaoguang_4D.java │ ├── Quick_Luoyaoguang_4DWithoutComb.java │ ├── Quick_Luoyaoguang_5D.java │ ├── SelectionSort.java │ ├── ShellSort.java │ └── TTreeSort.java ├── soundProcessor │ ├── ButterworthPro.java │ ├── BytestoAIS.java │ ├── Convolution.java │ ├── Guassian2dPro.java │ ├── HoughPro.java │ ├── LaplacianPro.java │ ├── MaxMiniPro.java │ ├── MedianPro.java │ ├── SoundAttribute.java │ ├── SoundFrequency.java │ ├── SoundLinesVector.java │ ├── SoundMedVector.java │ ├── SoundPlay.java │ ├── SoundRecord.java │ ├── SoundRegressionVector.java │ └── SoundWaveVector.java ├── steganographyProcessor │ ├── LineCodeOperation.java │ └── PixFloat.java ├── timeProcessor │ ├── Speed.java │ └── TimeCheck.java ├── waveProcessor │ ├── Common.java │ ├── Copy.java │ ├── DFT.java │ ├── FFT.java │ ├── Guassian.java │ ├── Laplasian.java │ ├── MaxAndMin.java │ ├── Median.java │ ├── PeakStatistic.java │ ├── Proportion.java │ ├── Quantification.java │ ├── Shehold.java │ └── Tailor.java └── zipProcessor │ ├── BootBackup.java │ ├── GzipUtil.java │ └── UnZip.java ├── LICENSE ├── README.md ├── build.gradle ├── gradlew ├── gradlew.bat ├── mu.png ├── pom.xml └── settings.gradle /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /bin/ 3 | /.gradle/ 4 | -------------------------------------------------------------------------------- /.gradle/4.10.3/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/4.10.3/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/.gradle/4.10.3/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/4.10.3/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/.gradle/4.10.3/gc.properties -------------------------------------------------------------------------------- /.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/.gradle/vcs-1/gc.properties -------------------------------------------------------------------------------- /.gradle/vcsWorkingDirs/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/.gradle/vcsWorkingDirs/gc.properties -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Data_Processor 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | org.eclipse.m2e.core.maven2Nature 27 | org.eclipse.buildship.core.gradleprojectnature 28 | 29 | 30 | -------------------------------------------------------------------------------- /.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(4.10.3)) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//DP/NLPProcessor/StopSymbol.java=UTF-8 3 | encoding//DP/NLPProcessor/TranditionChinese.java=UTF-8 4 | encoding//DP/sortProcessor/Quick_6D_luoyaoguang_Sort.java=UTF-8 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.release=disabled 6 | org.eclipse.jdt.core.compiler.source=1.8 7 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /2019021301.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/2019021301.png -------------------------------------------------------------------------------- /DP/MD5Processor/StringUtil.java: -------------------------------------------------------------------------------- 1 | package MD5Processor; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.security.MessageDigest; 5 | import java.security.NoSuchAlgorithmException; 6 | import java.util.Base64; 7 | 8 | public class StringUtil { 9 | public static String encode(String input) throws Exception { 10 | String result = Base64.getEncoder().encodeToString(input.getBytes("UTF-8")); 11 | return result; 12 | } 13 | public static String decode(String str) throws UnsupportedEncodingException { 14 | if(str.equalsIgnoreCase("undefined")) { 15 | return str; 16 | }else { 17 | return new String(Base64.getMimeDecoder().decode(str), "UTF-8"); 18 | } 19 | } 20 | public static String EncoderByMd5(String salt, String pwd, int enctimes) throws NoSuchAlgorithmException, 21 | UnsupportedEncodingException { 22 | String saltTemp = salt; 23 | for (int i = 0; i < enctimes; i++) { 24 | saltTemp = StringUtil.EncoderByMd5(saltTemp, pwd); 25 | } 26 | return saltTemp; 27 | } 28 | public static String EncoderByMd5(String salt, String pwd) throws NoSuchAlgorithmException, 29 | UnsupportedEncodingException { 30 | MessageDigest md5 = MessageDigest.getInstance("MD5"); 31 | md5.update((salt + "||" + pwd).getBytes("UTF-8")); 32 | StringBuffer buf = new StringBuffer(); 33 | for (byte b : md5.digest()) { 34 | buf.append(String.format("%02x", b & 0xBD)); 35 | } 36 | String md5pwd = buf.toString(); 37 | return md5pwd; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DP/MD5Processor/Token.java: -------------------------------------------------------------------------------- 1 | package MD5Processor; 2 | 3 | public class Token { 4 | public String getuEmail() { 5 | return uEmail; 6 | } 7 | public void setuEmail(String uEmail) { 8 | this.uEmail = uEmail; 9 | } 10 | public String getuKey() { 11 | return uKey; 12 | } 13 | public void setuKey(String uKey) { 14 | this.uKey = uKey; 15 | } 16 | public String getmPassword() { 17 | return mPassword; 18 | } 19 | public void setmPassword(String mPassword) { 20 | this.mPassword = mPassword; 21 | } 22 | public long getuTime() { 23 | return uTime; 24 | } 25 | public void setuTime(long uTime) { 26 | this.uTime = uTime; 27 | } 28 | private String uEmail; 29 | private String uKey; 30 | private String mPassword; 31 | private long uTime; 32 | } -------------------------------------------------------------------------------- /DP/MD5Processor/TokenUtil.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/MD5Processor/TokenUtil.java -------------------------------------------------------------------------------- /DP/MD5Processor/Usr.java: -------------------------------------------------------------------------------- 1 | package MD5Processor; 2 | 3 | public class Usr { 4 | public Integer getuAge() { 5 | return uAge; 6 | } 7 | public void setuAge(Integer uAge) { 8 | this.uAge = uAge; 9 | } 10 | public Integer getuId() { 11 | return uId; 12 | } 13 | public void setuId(Integer uId) { 14 | this.uId = uId; 15 | } 16 | public String getuName() { 17 | return uName; 18 | } 19 | public void setuName(String uName) { 20 | this.uName = uName; 21 | } 22 | public String getuSex() { 23 | return uSex; 24 | } 25 | public void setuSex(String uSex) { 26 | this.uSex = uSex; 27 | } 28 | public String getuPhone() { 29 | return uPhone; 30 | } 31 | public void setuPhone(String uPhone) { 32 | this.uPhone = uPhone; 33 | } 34 | public String getuAddress() { 35 | return uAddress; 36 | } 37 | public void setuAddress(String uAddress) { 38 | this.uAddress = uAddress; 39 | } 40 | public String getuWeChat() { 41 | return uWeChat; 42 | } 43 | public void setuWeChat(String uWeChat) { 44 | this.uWeChat = uWeChat; 45 | } 46 | public String getuClass() { 47 | return uClass; 48 | } 49 | public void setuClass(String uClass) { 50 | this.uClass = uClass; 51 | } 52 | public String getuEmail() { 53 | return uEmail; 54 | } 55 | public void setuEmail(String uEmail) { 56 | this.uEmail = uEmail; 57 | } 58 | public String getuQq() { 59 | return uQq; 60 | } 61 | public void setuQq(String uQq) { 62 | this.uQq = uQq; 63 | } 64 | public String getuPassword() { 65 | return uPassword; 66 | } 67 | public void setuPassword(String uPassword) { 68 | this.uPassword = uPassword; 69 | } 70 | private Integer uAge; 71 | private Integer uId; 72 | private String uName; 73 | private String uSex; 74 | private String uPhone; 75 | private String uAddress; 76 | private String uWeChat; 77 | private String uClass; 78 | private String uEmail; 79 | private String uQq; 80 | private String uPassword; 81 | } -------------------------------------------------------------------------------- /DP/MD5Processor/UsrToken.java: -------------------------------------------------------------------------------- 1 | package MD5Processor; 2 | 3 | public class UsrToken { 4 | public String getuLevel() { 5 | return uLevel; 6 | } 7 | public void setuLevel(String uLevel) { 8 | this.uLevel = uLevel; 9 | } 10 | public Integer getuId() { 11 | return uId; 12 | } 13 | public void setuId(Integer uId) { 14 | this.uId = uId; 15 | } 16 | public String getuKey() { 17 | return uKey; 18 | } 19 | public void setuKey(String uKey) { 20 | this.uKey = uKey; 21 | } 22 | public String getuPassword() { 23 | return uPassword; 24 | } 25 | public void setuPassword(String uPassword) { 26 | this.uPassword = uPassword; 27 | } 28 | public String getuToken() { 29 | return uToken; 30 | } 31 | public void setuToken(String uToken) { 32 | this.uToken = uToken; 33 | } 34 | public long getuTime() { 35 | return uTime; 36 | } 37 | public void setuTime(long uTime) { 38 | this.uTime = uTime; 39 | } 40 | private Integer uId; 41 | private String uKey; 42 | private String uPassword; 43 | private String uToken; 44 | private String uLevel; 45 | private long uTime; 46 | } -------------------------------------------------------------------------------- /DP/NLPProcessor/DETA_ANN_HMM.java: -------------------------------------------------------------------------------- 1 | package NLPProcessor; 2 | import java.io.IOException; 3 | public class DETA_ANN_HMM { 4 | public String[][] summingProcessor(String[][] inputNLP) throws IOException, InstantiationException, IllegalAccessException { 5 | String[][] outNLP = inputNLP.clone(); 6 | for(int i = 7; i < inputNLP[0].length; i++) { 7 | for(int j = 0; j < inputNLP.length; j++) { 8 | double sum = 0; 9 | for(int k = 0;k < inputNLP.length; k++) { 10 | sum += Double.valueOf(inputNLP[k][i]); 11 | } 12 | //System.out.println(sum); 13 | outNLP[j][i] = "" + Double.valueOf(inputNLP[j][i])/sum; 14 | } 15 | } 16 | return outNLP; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DP/NLPProcessor/DETA_DNN.java: -------------------------------------------------------------------------------- 1 | package NLPProcessor; 2 | import java.io.IOException; 3 | public class DETA_DNN { 4 | //Theory:DNN 5 | //Algorithm Author Mr.Yaoguang Luo 6 | public String[][] summingProcessor(String[][] ann, String[][] rnn) throws IOException 7 | , InstantiationException, IllegalAccessException { 8 | //SUM OF LWA DNN 9 | //1 DNN AOP OF DNN 10 | //IDE= "Ç×ÃÜ£¬ÀëÉ¢£¬Î»ÖÃ" 11 | String[][] dnn = new String[rnn.length][4]; 12 | for(int i = 0; i < rnn.length; i++) { 13 | dnn[i][0] = rnn[i][0]; 14 | double important = 0; 15 | for(int j = 0; j < rnn.length; j++) { 16 | important += Double.parseDouble(rnn[j][2]); 17 | } 18 | dnn[i][1] = "" + Math.sqrt(important * Double.parseDouble(rnn[i][1])); 19 | } 20 | //2 DNN CORRELATION LWA 21 | for(int i = 0; i < rnn.length; i++) { 22 | double correlation = 0; 23 | double sumOfPow = 0; 24 | for(int j = 0; j < rnn.length; j++) { 25 | sumOfPow += Double.parseDouble(rnn[j][3]); 26 | //sumOfPow += Math.abs(Double.parseDouble(rnn[i][3]) - Double.parseDouble(rnn[j][3])); 27 | } 28 | //2 sumOfPow = Math.abs(Double.parseDouble(rnn[i][3]) * (double)rnn.length - sumOfPow); 29 | // sumOfPow /= rnn.length; 30 | sumOfPow = Math.abs(Double.parseDouble(rnn[i][3]) - sumOfPow/rnn.length);//3 31 | correlation = Double.parseDouble(dnn[i][1]) * sumOfPow; 32 | dnn[i][2] = "" + Math.sqrt(correlation); 33 | } 34 | //3 DNN and summing ANN combination 35 | for(int i = 0; i < ann.length; i++) { 36 | double summingANN = 0; 37 | double combination = 0; 38 | for(int j = 7; j < ann[0].length; j++) { 39 | summingANN += Double.parseDouble(ann[i][j]); 40 | } 41 | combination = summingANN * Double.parseDouble(dnn[i][2]); 42 | dnn[i][3] = "" + combination; 43 | } 44 | return dnn; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DP/NLPProcessor/StopSymbol.java: -------------------------------------------------------------------------------- 1 | package NLPProcessor; 2 | public interface StopSymbol{ 3 | //REFER http://www.fhdq.net/ 4 | public static final String symbol="~!@#$%^&*()_+`1234567890-= {}:\"|?><[]\\';,./'。,、':∶;?‘’“”〝〞ˆˇ﹕︰﹔﹖﹑·¨….¸;!´?!~—ˉ|‖"〃`@﹫¡¿﹏﹋﹌︴々﹟#﹩$﹠&﹪%*﹡﹢﹦﹤‐ ̄¯―﹨ˆ˜﹍﹎+=<­­__-\\ˇ~﹉﹊()〈〉‹›﹛﹜『』〖〗[]《》〔〕{}「」【】︵︷︿︹︽_﹁﹃︻︶︸﹀︺︾ˉ﹂﹄︼"; 5 | } 6 | -------------------------------------------------------------------------------- /DP/NLPProcessor/TranditionChinese.java: -------------------------------------------------------------------------------- 1 | package NLPProcessor; 2 | public interface TranditionChinese{ 3 | //word base from https://blog.csdn.net/u010523770/article/details/60873241 4 | public static final String simpleTypeChinese="万与丑专业丛东丝丢两严丧个丬丰临为丽举么义乌乐乔习乡书买乱争于亏云亘亚产亩亲亵亸亿仅从仑仓仪们价众优伙会伛伞伟传伤伥伦伧伪伫体余佣佥侠侣侥侦侧侨侩侪侬俣俦俨俩俪俭债倾偬偻偾偿傥傧储傩儿兑兖党兰关兴兹养兽冁内冈册写军农冢冯冲决况冻净凄凉凌减凑凛几凤凫凭凯击凼凿刍划刘则刚创删别刬刭刽刿剀剂剐剑剥剧劝办务劢动励劲劳势勋勐勚匀匦匮区医华协单卖卢卤卧卫却卺厂厅历厉压厌厍厕厢厣厦厨厩厮县参叆叇双发变叙叠叶号叹叽吁后吓吕吗吣吨听启吴呒呓呕呖呗员呙呛呜咏咔咙咛咝咤咴咸哌响哑哒哓哔哕哗哙哜哝哟唛唝唠唡唢唣唤唿啧啬啭啮啰啴啸喷喽喾嗫呵嗳嘘嘤嘱噜噼嚣嚯团园囱围囵国图圆圣圹场坂坏块坚坛坜坝坞坟坠垄垅垆垒垦垧垩垫垭垯垱垲垴埘埙埚埝埯堑堕塆墙壮声壳壶壸处备复够头夸夹夺奁奂奋奖奥妆妇妈妩妪妫姗姜娄娅娆娇娈娱娲娴婳婴婵婶媪嫒嫔嫱嬷孙学孪宁宝实宠审宪宫宽宾寝对寻导寿将尔尘尧尴尸尽层屃屉届属屡屦屿岁岂岖岗岘岙岚岛岭岳岽岿峃峄峡峣峤峥峦崂崃崄崭嵘嵚嵛嵝嵴巅巩巯币帅师帏帐帘帜带帧帮帱帻帼幂幞干并广庄庆庐庑库应庙庞废庼廪开异弃张弥弪弯弹强归当录彟彦彻径徕御忆忏忧忾怀态怂怃怄怅怆怜总怼怿恋恳恶恸恹恺恻恼恽悦悫悬悭悯惊惧惨惩惫惬惭惮惯愍愠愤愦愿慑慭憷懑懒懔戆戋戏戗战戬户扎扑扦执扩扪扫扬扰抚抛抟抠抡抢护报担拟拢拣拥拦拧拨择挂挚挛挜挝挞挟挠挡挢挣挤挥挦捞损捡换捣据捻掳掴掷掸掺掼揸揽揿搀搁搂搅携摄摅摆摇摈摊撄撑撵撷撸撺擞攒敌敛数斋斓斗斩断无旧时旷旸昙昼昽显晋晒晓晔晕晖暂暧札术朴机杀杂权条来杨杩杰极构枞枢枣枥枧枨枪枫枭柜柠柽栀栅标栈栉栊栋栌栎栏树栖样栾桊桠桡桢档桤桥桦桧桨桩梦梼梾检棂椁椟椠椤椭楼榄榇榈榉槚槛槟槠横樯樱橥橱橹橼檐檩欢欤欧歼殁殇残殒殓殚殡殴毁毂毕毙毡毵氇气氢氩氲汇汉污汤汹沓沟没沣沤沥沦沧沨沩沪沵泞泪泶泷泸泺泻泼泽泾洁洒洼浃浅浆浇浈浉浊测浍济浏浐浑浒浓浔浕涂涌涛涝涞涟涠涡涢涣涤润涧涨涩淀渊渌渍渎渐渑渔渖渗温游湾湿溃溅溆溇滗滚滞滟滠满滢滤滥滦滨滩滪漤潆潇潋潍潜潴澜濑濒灏灭灯灵灾灿炀炉炖炜炝点炼炽烁烂烃烛烟烦烧烨烩烫烬热焕焖焘煅煳熘爱爷牍牦牵牺犊犟状犷犸犹狈狍狝狞独狭狮狯狰狱狲猃猎猕猡猪猫猬献獭玑玙玚玛玮环现玱玺珉珏珐珑珰珲琎琏琐琼瑶瑷璇璎瓒瓮瓯电画畅畲畴疖疗疟疠疡疬疮疯疱疴痈痉痒痖痨痪痫痴瘅瘆瘗瘘瘪瘫瘾瘿癞癣癫癯皑皱皲盏盐监盖盗盘眍眦眬着睁睐睑瞒瞩矫矶矾矿砀码砖砗砚砜砺砻砾础硁硅硕硖硗硙硚确硷碍碛碜碱碹磙礼祎祢祯祷祸禀禄禅离秃秆种积称秽秾稆税稣稳穑穷窃窍窑窜窝窥窦窭竖竞笃笋笔笕笺笼笾筑筚筛筜筝筹签简箓箦箧箨箩箪箫篑篓篮篱簖籁籴类籼粜粝粤粪粮糁糇紧絷纟纠纡红纣纤纥约级纨纩纪纫纬纭纮纯纰纱纲纳纴纵纶纷纸纹纺纻纼纽纾线绀绁绂练组绅细织终绉绊绋绌绍绎经绐绑绒结绔绕绖绗绘给绚绛络绝绞统绠绡绢绣绤绥绦继绨绩绪绫绬续绮绯绰绱绲绳维绵绶绷绸绹绺绻综绽绾绿缀缁缂缃缄缅缆缇缈缉缊缋缌缍缎缏缐缑缒缓缔缕编缗缘缙缚缛缜缝缞缟缠缡缢缣缤缥缦缧缨缩缪缫缬缭缮缯缰缱缲缳缴缵罂网罗罚罢罴羁羟羡翘翙翚耢耧耸耻聂聋职聍联聩聪肃肠肤肷肾肿胀胁胆胜胧胨胪胫胶脉脍脏脐脑脓脔脚脱脶脸腊腌腘腭腻腼腽腾膑臜舆舣舰舱舻艰艳艹艺节芈芗芜芦苁苇苈苋苌苍苎苏苘苹茎茏茑茔茕茧荆荐荙荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莅莜莱莲莳莴莶获莸莹莺莼萚萝萤营萦萧萨葱蒇蒉蒋蒌蓝蓟蓠蓣蓥蓦蔷蔹蔺蔼蕲蕴薮藁藓虏虑虚虫虬虮虽虾虿蚀蚁蚂蚕蚝蚬蛊蛎蛏蛮蛰蛱蛲蛳蛴蜕蜗蜡蝇蝈蝉蝎蝼蝾螀螨蟏衅衔补衬衮袄袅袆袜袭袯装裆裈裢裣裤裥褛褴襁襕见观觃规觅视觇览觉觊觋觌觍觎觏觐觑觞触觯詟誉誊讠计订讣认讥讦讧讨让讪讫训议讯记讱讲讳讴讵讶讷许讹论讻讼讽设访诀证诂诃评诅识诇诈诉诊诋诌词诎诏诐译诒诓诔试诖诗诘诙诚诛诜话诞诟诠诡询诣诤该详诧诨诩诪诫诬语诮误诰诱诲诳说诵诶请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊谋谌谍谎谏谐谑谒谓谔谕谖谗谘谙谚谛谜谝谞谟谠谡谢谣谤谥谦谧谨谩谪谫谬谭谮谯谰谱谲谳谴谵谶谷豮贝贞负贠贡财责贤败账货质贩贪贫贬购贮贯贰贱贲贳贴贵贶贷贸费贺贻贼贽贾贿赀赁赂赃资赅赆赇赈赉赊赋赌赍赎赏赐赑赒赓赔赕赖赗赘赙赚赛赜赝赞赟赠赡赢赣赪赵赶趋趱趸跃跄跖跞践跶跷跸跹跻踊踌踪踬踯蹑蹒蹰蹿躏躜躯车轧轨轩轪轫转轭轮软轰轱轲轳轴轵轶轷轸轹轺轻轼载轾轿辀辁辂较辄辅辆辇辈辉辊辋辌辍辎辏辐辑辒输辔辕辖辗辘辙辚辞辩辫边辽达迁过迈运还这进远违连迟迩迳迹适选逊递逦逻遗遥邓邝邬邮邹邺邻郁郄郏郐郑郓郦郧郸酝酦酱酽酾酿释里鉅鉴銮錾钆钇针钉钊钋钌钍钎钏钐钑钒钓钔钕钖钗钘钙钚钛钝钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铍铎铏铐铑铒铕铗铘铙铚铛铜铝铞铟铠铡铢铣铤铥铦铧铨铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐锑锒锓锔锕锖锗错锚锜锞锟锠锡锢锣锤锥锦锨锩锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀镁镂镃镆镇镈镉镊镌镍镎镏镐镑镒镕镖镗镙镚镛镜镝镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镶长门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸闹闺闻闼闽闾闿阀阁阂阃阄阅阆阇阈阉阊阋阌阍阎阏阐阑阒阓阔阕阖阗阘阙阚阛队阳阴阵阶际陆陇陈陉陕陧陨险随隐隶隽难雏雠雳雾霁霉霭靓静靥鞑鞒鞯鞴韦韧韨韩韪韫韬韵页顶顷顸项顺须顼顽顾顿颀颁颂颃预颅领颇颈颉颊颋颌颍颎颏颐频颒颓颔颕颖颗题颙颚颛颜额颞颟颠颡颢颣颤颥颦颧风飏飐飑飒飓飔飕飖飗飘飙飚飞飨餍饤饥饦饧饨饩饪饫饬饭饮饯饰饱饲饳饴饵饶饷饸饹饺饻饼饽饾饿馀馁馂馃馄馅馆馇馈馉馊馋馌馍馎馏馐馑馒馓馔馕马驭驮驯驰驱驲驳驴驵驶驷驸驹驺驻驼驽驾驿骀骁骂骃骄骅骆骇骈骉骊骋验骍骎骏骐骑骒骓骔骕骖骗骘骙骚骛骜骝骞骟骠骡骢骣骤骥骦骧髅髋髌鬓魇魉鱼鱽鱾鱿鲀鲁鲂鲄鲅鲆鲇鲈鲉鲊鲋鲌鲍鲎鲏鲐鲑鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜鲝鲞鲟鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲪鲫鲬鲭鲮鲯鲰鲱鲲鲳鲴鲵鲶鲷鲸鲹鲺鲻鲼鲽鲾鲿鳀鳁鳂鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌鳍鳎鳏鳐鳑鳒鳓鳔鳕鳖鳗鳘鳙鳛鳜鳝鳞鳟鳠鳡鳢鳣鸟鸠鸡鸢鸣鸤鸥鸦鸧鸨鸩鸪鸫鸬鸭鸮鸯鸰鸱鸲鸳鸴鸵鸶鸷鸸鸹鸺鸻鸼鸽鸾鸿鹀鹁鹂鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌鹍鹎鹏鹐鹑鹒鹓鹔鹕鹖鹗鹘鹚鹛鹜鹝鹞鹟鹠鹡鹢鹣鹤鹥鹦鹧鹨鹩鹪鹫鹬鹭鹯鹰鹱鹲鹳鹴鹾麦麸黄黉黡黩黪黾鼋鼌鼍鼗鼹齄齐齑齿龀龁龂龃龄龅龆龇龈龉龊龋龌龙龚龛龟志制咨只里系范松没尝尝闹面准钟别闲干尽脏拼"; 5 | public static final String tranditionChinese="萬與醜專業叢東絲丟兩嚴喪個爿豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亙亞產畝親褻嚲億僅從侖倉儀們價眾優夥會傴傘偉傳傷倀倫傖偽佇體餘傭僉俠侶僥偵側僑儈儕儂俁儔儼倆儷儉債傾傯僂僨償儻儐儲儺兒兌兗黨蘭關興茲養獸囅內岡冊寫軍農塚馮衝決況凍淨淒涼淩減湊凜幾鳳鳧憑凱擊氹鑿芻劃劉則剛創刪別剗剄劊劌剴劑剮劍剝劇勸辦務勱動勵勁勞勢勳猛勩勻匭匱區醫華協單賣盧鹵臥衛卻巹廠廳曆厲壓厭厙廁廂厴廈廚廄廝縣參靉靆雙發變敘疊葉號歎嘰籲後嚇呂嗎唚噸聽啟吳嘸囈嘔嚦唄員咼嗆嗚詠哢嚨嚀噝吒噅鹹呱響啞噠嘵嗶噦嘩噲嚌噥喲嘜嗊嘮啢嗩唕喚呼嘖嗇囀齧囉嘽嘯噴嘍嚳囁嗬噯噓嚶囑嚕劈囂謔團園囪圍圇國圖圓聖壙場阪壞塊堅壇壢壩塢墳墜壟壟壚壘墾坰堊墊埡墶壋塏堖塒塤堝墊垵塹墮壪牆壯聲殼壺壼處備複夠頭誇夾奪奩奐奮獎奧妝婦媽嫵嫗媯姍薑婁婭嬈嬌孌娛媧嫻嫿嬰嬋嬸媼嬡嬪嬙嬤孫學孿寧寶實寵審憲宮寬賓寢對尋導壽將爾塵堯尷屍盡層屭屜屆屬屢屨嶼歲豈嶇崗峴嶴嵐島嶺嶽崠巋嶨嶧峽嶢嶠崢巒嶗崍嶮嶄嶸嶔崳嶁脊巔鞏巰幣帥師幃帳簾幟帶幀幫幬幘幗冪襆幹並廣莊慶廬廡庫應廟龐廢廎廩開異棄張彌弳彎彈強歸當錄彠彥徹徑徠禦憶懺憂愾懷態慫憮慪悵愴憐總懟懌戀懇惡慟懨愷惻惱惲悅愨懸慳憫驚懼慘懲憊愜慚憚慣湣慍憤憒願懾憖怵懣懶懍戇戔戲戧戰戩戶紮撲扡執擴捫掃揚擾撫拋摶摳掄搶護報擔擬攏揀擁攔擰撥擇掛摯攣掗撾撻挾撓擋撟掙擠揮撏撈損撿換搗據撚擄摑擲撣摻摜摣攬撳攙擱摟攪攜攝攄擺搖擯攤攖撐攆擷擼攛擻攢敵斂數齋斕鬥斬斷無舊時曠暘曇晝曨顯晉曬曉曄暈暉暫曖劄術樸機殺雜權條來楊榪傑極構樅樞棗櫪梘棖槍楓梟櫃檸檉梔柵標棧櫛櫳棟櫨櫟欄樹棲樣欒棬椏橈楨檔榿橋樺檜槳樁夢檮棶檢欞槨櫝槧欏橢樓欖櫬櫚櫸檟檻檳櫧橫檣櫻櫫櫥櫓櫞簷檁歡歟歐殲歿殤殘殞殮殫殯毆毀轂畢斃氈毿氌氣氫氬氳彙漢汙湯洶遝溝沒灃漚瀝淪滄渢溈滬濔濘淚澩瀧瀘濼瀉潑澤涇潔灑窪浹淺漿澆湞溮濁測澮濟瀏滻渾滸濃潯濜塗湧濤澇淶漣潿渦溳渙滌潤澗漲澀澱淵淥漬瀆漸澠漁瀋滲溫遊灣濕潰濺漵漊潷滾滯灩灄滿瀅濾濫灤濱灘澦濫瀠瀟瀲濰潛瀦瀾瀨瀕灝滅燈靈災燦煬爐燉煒熗點煉熾爍爛烴燭煙煩燒燁燴燙燼熱煥燜燾煆糊溜愛爺牘犛牽犧犢強狀獷獁猶狽麅獮獰獨狹獅獪猙獄猻獫獵獼玀豬貓蝟獻獺璣璵瑒瑪瑋環現瑲璽瑉玨琺瓏璫琿璡璉瑣瓊瑤璦璿瓔瓚甕甌電畫暢佘疇癤療瘧癘瘍鬁瘡瘋皰屙癰痙癢瘂癆瘓癇癡癉瘮瘞瘺癟癱癮癭癩癬癲臒皚皺皸盞鹽監蓋盜盤瞘眥矓著睜睞瞼瞞矚矯磯礬礦碭碼磚硨硯碸礪礱礫礎硜矽碩硤磽磑礄確鹼礙磧磣堿镟滾禮禕禰禎禱禍稟祿禪離禿稈種積稱穢穠穭稅穌穩穡窮竊竅窯竄窩窺竇窶豎競篤筍筆筧箋籠籩築篳篩簹箏籌簽簡籙簀篋籜籮簞簫簣簍籃籬籪籟糴類秈糶糲粵糞糧糝餱緊縶糸糾紆紅紂纖紇約級紈纊紀紉緯紜紘純紕紗綱納紝縱綸紛紙紋紡紵紖紐紓線紺絏紱練組紳細織終縐絆紼絀紹繹經紿綁絨結絝繞絰絎繪給絢絳絡絕絞統綆綃絹繡綌綏絛繼綈績緒綾緓續綺緋綽緔緄繩維綿綬繃綢綯綹綣綜綻綰綠綴緇緙緗緘緬纜緹緲緝縕繢緦綞緞緶線緱縋緩締縷編緡緣縉縛縟縝縫縗縞纏縭縊縑繽縹縵縲纓縮繆繅纈繚繕繒韁繾繰繯繳纘罌網羅罰罷羆羈羥羨翹翽翬耮耬聳恥聶聾職聹聯聵聰肅腸膚膁腎腫脹脅膽勝朧腖臚脛膠脈膾髒臍腦膿臠腳脫腡臉臘醃膕齶膩靦膃騰臏臢輿艤艦艙艫艱豔艸藝節羋薌蕪蘆蓯葦藶莧萇蒼苧蘇檾蘋莖蘢蔦塋煢繭荊薦薘莢蕘蓽蕎薈薺蕩榮葷滎犖熒蕁藎蓀蔭蕒葒葤藥蒞蓧萊蓮蒔萵薟獲蕕瑩鶯蓴蘀蘿螢營縈蕭薩蔥蕆蕢蔣蔞藍薊蘺蕷鎣驀薔蘞藺藹蘄蘊藪槁蘚虜慮虛蟲虯蟣雖蝦蠆蝕蟻螞蠶蠔蜆蠱蠣蟶蠻蟄蛺蟯螄蠐蛻蝸蠟蠅蟈蟬蠍螻蠑螿蟎蠨釁銜補襯袞襖嫋褘襪襲襏裝襠褌褳襝褲襇褸襤繈襴見觀覎規覓視覘覽覺覬覡覿覥覦覯覲覷觴觸觶讋譽謄訁計訂訃認譏訐訌討讓訕訖訓議訊記訒講諱謳詎訝訥許訛論訩訟諷設訪訣證詁訶評詛識詗詐訴診詆謅詞詘詔詖譯詒誆誄試詿詩詰詼誠誅詵話誕詬詮詭詢詣諍該詳詫諢詡譸誡誣語誚誤誥誘誨誑說誦誒請諸諏諾讀諑誹課諉諛誰諗調諂諒諄誶談誼謀諶諜謊諫諧謔謁謂諤諭諼讒諮諳諺諦謎諞諝謨讜謖謝謠謗諡謙謐謹謾謫譾謬譚譖譙讕譜譎讞譴譫讖穀豶貝貞負貟貢財責賢敗賬貨質販貪貧貶購貯貫貳賤賁貰貼貴貺貸貿費賀貽賊贄賈賄貲賃賂贓資賅贐賕賑賚賒賦賭齎贖賞賜贔賙賡賠賧賴賵贅賻賺賽賾贗讚贇贈贍贏贛赬趙趕趨趲躉躍蹌蹠躒踐躂蹺蹕躚躋踴躊蹤躓躑躡蹣躕躥躪躦軀車軋軌軒軑軔轉軛輪軟轟軲軻轤軸軹軼軤軫轢軺輕軾載輊轎輈輇輅較輒輔輛輦輩輝輥輞輬輟輜輳輻輯轀輸轡轅轄輾轆轍轔辭辯辮邊遼達遷過邁運還這進遠違連遲邇逕跡適選遜遞邐邏遺遙鄧鄺鄔郵鄒鄴鄰鬱郤郟鄶鄭鄆酈鄖鄲醞醱醬釅釃釀釋裏钜鑒鑾鏨釓釔針釘釗釙釕釷釺釧釤鈒釩釣鍆釹鍚釵鈃鈣鈈鈦鈍鈔鍾鈉鋇鋼鈑鈐鑰欽鈞鎢鉤鈧鈁鈥鈄鈕鈀鈺錢鉦鉗鈷缽鈳鉕鈽鈸鉞鑽鉬鉭鉀鈿鈾鐵鉑鈴鑠鉛鉚鈰鉉鉈鉍鈹鐸鉶銬銠鉺銪鋏鋣鐃銍鐺銅鋁銱銦鎧鍘銖銑鋌銩銛鏵銓鉿銚鉻銘錚銫鉸銥鏟銃鐋銨銀銣鑄鐒鋪鋙錸鋱鏈鏗銷鎖鋰鋥鋤鍋鋯鋨鏽銼鋝鋒鋅鋶鐦鐧銳銻鋃鋟鋦錒錆鍺錯錨錡錁錕錩錫錮鑼錘錐錦鍁錈錇錟錠鍵鋸錳錙鍥鍈鍇鏘鍶鍔鍤鍬鍾鍛鎪鍠鍰鎄鍍鎂鏤鎡鏌鎮鎛鎘鑷鐫鎳鎿鎦鎬鎊鎰鎔鏢鏜鏍鏰鏞鏡鏑鏃鏇鏐鐔钁鐐鏷鑥鐓鑭鐠鑹鏹鐙鑊鐳鐶鐲鐮鐿鑔鑣鑞鑲長門閂閃閆閈閉問闖閏闈閑閎間閔閌悶閘鬧閨聞闥閩閭闓閥閣閡閫鬮閱閬闍閾閹閶鬩閿閽閻閼闡闌闃闠闊闋闔闐闒闕闞闤隊陽陰陣階際陸隴陳陘陝隉隕險隨隱隸雋難雛讎靂霧霽黴靄靚靜靨韃鞽韉韝韋韌韍韓韙韞韜韻頁頂頃頇項順須頊頑顧頓頎頒頌頏預顱領頗頸頡頰頲頜潁熲頦頤頻頮頹頷頴穎顆題顒顎顓顏額顳顢顛顙顥纇顫顬顰顴風颺颭颮颯颶颸颼颻飀飄飆飆飛饗饜飣饑飥餳飩餼飪飫飭飯飲餞飾飽飼飿飴餌饒餉餄餎餃餏餅餑餖餓餘餒餕餜餛餡館餷饋餶餿饞饁饃餺餾饈饉饅饊饌饢馬馭馱馴馳驅馹駁驢駔駛駟駙駒騶駐駝駑駕驛駘驍罵駰驕驊駱駭駢驫驪騁驗騂駸駿騏騎騍騅騌驌驂騙騭騤騷騖驁騮騫騸驃騾驄驏驟驥驦驤髏髖髕鬢魘魎魚魛魢魷魨魯魴魺鮁鮃鯰鱸鮋鮓鮒鮊鮑鱟鮍鮐鮭鮚鮳鮪鮞鮦鰂鮜鱠鱭鮫鮮鮺鯗鱘鯁鱺鰱鰹鯉鰣鰷鯀鯊鯇鮶鯽鯒鯖鯪鯕鯫鯡鯤鯧鯝鯢鯰鯛鯨鯵鯴鯔鱝鰈鰏鱨鯷鰮鰃鰓鱷鰍鰒鰉鰁鱂鯿鰠鼇鰭鰨鰥鰩鰟鰜鰳鰾鱈鱉鰻鰵鱅鰼鱖鱔鱗鱒鱯鱤鱧鱣鳥鳩雞鳶鳴鳲鷗鴉鶬鴇鴆鴣鶇鸕鴨鴞鴦鴒鴟鴝鴛鴬鴕鷥鷙鴯鴰鵂鴴鵃鴿鸞鴻鵐鵓鸝鵑鵠鵝鵒鷳鵜鵡鵲鶓鵪鶤鵯鵬鵮鶉鶊鵷鷫鶘鶡鶚鶻鶿鶥鶩鷊鷂鶲鶹鶺鷁鶼鶴鷖鸚鷓鷚鷯鷦鷲鷸鷺鸇鷹鸌鸏鸛鸘鹺麥麩黃黌黶黷黲黽黿鼂鼉鞀鼴齇齊齏齒齔齕齗齟齡齙齠齜齦齬齪齲齷龍龔龕龜誌製谘隻裡係範鬆冇嚐嘗鬨麵準鐘彆閒乾儘臟拚"; 6 | } 7 | -------------------------------------------------------------------------------- /DP/cacheProcessor/Cache.java: -------------------------------------------------------------------------------- 1 | package cacheProcessor; 2 | public class Cache { 3 | private String key; 4 | private Object value; 5 | private long timeOut; 6 | private boolean expired; 7 | public Cache() { 8 | super(); 9 | } 10 | 11 | public Cache(String key, Object value, long timeOut, boolean expired) { 12 | this.key = key; 13 | this.value = value; 14 | this.timeOut = timeOut; 15 | this.expired = expired; 16 | } 17 | 18 | public String getKey() { 19 | return key; 20 | } 21 | 22 | public long getTimeOut() { 23 | return timeOut; 24 | } 25 | 26 | public Object getValue() { 27 | return value; 28 | } 29 | 30 | public void setKey(String string) { 31 | key = string; 32 | } 33 | 34 | public void setTimeOut(long l) { 35 | timeOut = l; 36 | } 37 | 38 | public void setValue(Object object) { 39 | value = object; 40 | } 41 | 42 | public boolean isExpired() { 43 | return expired; 44 | } 45 | 46 | public void setExpired(boolean b) { 47 | expired = b; 48 | } 49 | } -------------------------------------------------------------------------------- /DP/cacheProcessor/CacheManager.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/cacheProcessor/CacheManager.java -------------------------------------------------------------------------------- /DP/imageProcessor/CheckRange.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/imageProcessor/CheckRange.java -------------------------------------------------------------------------------- /DP/imageProcessor/Closing.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | public class Closing { 3 | public int[][] Processor(int[][]g, int[][]kenel){ 4 | int[][] closing= new Dilation().Processor(g, kenel); 5 | closing= new Erosion().Processor(closing, kenel); 6 | return closing; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /DP/imageProcessor/ConvexHull.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import java.io.BufferedWriter; 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | import java.io.OutputStreamWriter; 7 | import java.util.List; 8 | import java.util.Vector; 9 | public class ConvexHull { 10 | double seconds; 11 | public List convexHull(List vertices){ 12 | List polygon= new Vector(); 13 | int sx,lx; 14 | Vertex vcurr= null; 15 | Vertex vnext= null; 16 | int i,x; 17 | lx= vertices.get(0).x; 18 | sx= vertices.get(0).x; 19 | for(i= 1; i< vertices.size(); i++) { 20 | x = vertices.get(i).x; 21 | if(x>lx) lx= x; 22 | if(x vcurr.y)) { 26 | vcurr= v; 27 | } 28 | } 29 | int dxs, dys; 30 | int dxc, dyc; 31 | int dxt, dyt; 32 | int lqc, lqt; 33 | int scmp; 34 | polygon.add(vcurr); 35 | dys= 1; dxs= 0; 36 | while(vcurr.x<= lx) { 37 | dyc = -1; dxc = 0; lqc = 0; 38 | for(Vertex v: vertices) { 39 | if(v.x>= vcurr.x) { 40 | dyt= v.y- vcurr.y; 41 | dxt= v.x- vcurr.x; 42 | if(compareSlope(dyt,dxt,dys,dxs)== -1) { 43 | scmp= compareSlope(dyt, dxt, dyc, dxc); 44 | lqt= dyt* dyt+ dxt* dxt; 45 | if(scmp>= 0) { 46 | if(scmp> 0 || lqt> lqc) { 47 | vnext= v; 48 | dyc= dyt; 49 | dxc= dxt; 50 | lqc= lqt; 51 | } 52 | } 53 | } 54 | } 55 | } 56 | if(vnext== null) {break;} 57 | dys= dyc; dxs= dxc; 58 | polygon.add(vnext); 59 | vertices.remove(vnext); 60 | vcurr = vnext; vnext = null; 61 | } 62 | dys = 1; dxs = 0; 63 | while(vcurr.x> sx) { 64 | dyc= -1; dxc= 0; lqc= 0; 65 | for(Vertex v: vertices) { 66 | if(v.x= 0) { 73 | if(scmp> 0|| lqt> lqc) { 74 | vnext= v; 75 | dyc= dyt; 76 | dxc= dxt; 77 | lqc= lqt; 78 | } 79 | } 80 | } 81 | } 82 | } 83 | 84 | if(vnext==null) break; 85 | dys = dyc; dxs = dxc; 86 | polygon.add(vnext); 87 | vertices.remove(vnext); 88 | vcurr = vnext; vnext = null; 89 | } 90 | return polygon; 91 | } 92 | public int compareSlope(int dy2, int dx2, int dy1, int dx1) { 93 | if(dx2!=0 && dx1!=0) { 94 | double test = dy2*dx1-dy1*dx2; 95 | return (int)Math.signum(test); 96 | } else { 97 | if(dx2!=0 || dx1!=0) { 98 | if(dx2==0) { 99 | return dy2>=0 ? 1 : -1; 100 | } else { 101 | return dy1>=0 ? -1 : 1; 102 | } 103 | } else { 104 | if(dy2>=0) { 105 | return dy1>=0 ? 0 : 1; 106 | } else { 107 | return dy1>=0 ? -1 : 0; 108 | } 109 | } 110 | } 111 | } 112 | public class Vertex { 113 | public int x; 114 | public int y; 115 | public Vertex(int x, int y) { 116 | this.x = x; 117 | this.y = y; 118 | } 119 | } 120 | public void PNGWrite(int[][] g, int pix, String output) throws IOException { 121 | int [][]g1=new int[g.length][g[0].length]; 122 | int n=0; 123 | for(int p=0;p vertices = new Vector(); 145 | for(int i1=0;i1 polygon = convexHull(vertices); 152 | long elapsed = System.currentTimeMillis()-begin; 153 | seconds = elapsed/1000.0; 154 | //converx to g[][] 155 | for(int p=0;p vertices = new Vector(); 191 | for(int i1=0;i1 polygon = convexHull(vertices); 198 | long elapsed = System.currentTimeMillis()-begin; 199 | seconds = elapsed/1000.0; 200 | //converx to g[][] 201 | for(int p=0;p0){ 36 | tempG[i-w/2+p][j-h/2+q]=thisG[i][j]; 37 | } 38 | } 39 | } 40 | } 41 | } 42 | } 43 | return tempG; 44 | } 45 | } -------------------------------------------------------------------------------- /DP/imageProcessor/Emboss.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import java.io.IOException; 3 | public class Emboss { 4 | public int[][] Processor( int[][] g) throws IOException { 5 | int[][] refG= new Reflection().PadImage(g, 3, 3); 6 | int[]size= {g.length,g[0].length}; 7 | double[][] Gx= new double [size[0]][size[1]]; 8 | int[][] gxk= new int[][]{{-1, 0, 0}, 9 | {0, 0, 0}, 10 | {0, 0, 1}};; 11 | //GROUP OPERATION 12 | Gx= new GroupOperator().GO(gxk, refG, size); 13 | for(int i= 0; i< Gx.length; i++){ 14 | for(int j= 0;j< Gx[0].length; j++){ 15 | g[i][j]= (int)(Gx[i][j]/2+127); 16 | } 17 | } 18 | int out[][]= new int[g.length][g[0].length]; 19 | for (int i= 0; i< g.length; i++) { 20 | for (int j= 0; j< g[0].length; j++) { 21 | out[i][j]= g[i][j]; 22 | } 23 | } 24 | return new CheckRange().Processor(out); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DP/imageProcessor/Erosion.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import imageProcessor.Reflection; 3 | public class Erosion{ 4 | int[][] kernel; 5 | int[][] GetRegion; 6 | int[][] tempG; 7 | private void initTemp(int[][]thisG) { 8 | tempG= new int[thisG.length][thisG[0].length]; 9 | for(int i= 0; i< thisG.length; i++){ 10 | for(int j=0; j"+ sumhere); 21 | //--normalization 22 | double sum1= 0; 23 | for(int i=0; i"+ sumrow); 64 | //--normalization row 65 | double sum1= 0; 66 | for(int i= 0; i"+sumcol); 85 | //--normalization col 86 | double sum2= 0; 87 | for(int i= d/ 2; i< d/ 2+ 1; ++i){ 88 | for(int j=0; j) 109 | g[i-d/2][j-e/2]=(int)(sum); 110 | // flac_grn[i][j]=(int)sum; 111 | } 112 | } 113 | //REFLACTION a new of rowed grn 114 | flac_grn=new Reflection().PadImage(g, d, e); 115 | //GAUSSIAN pro for col 116 | for (int i=d/2;i0){ 54 | temp=1; 55 | } 56 | } 57 | if(kenel[p][q]==0){ 58 | if(thisG[i-w/2+p][j-h/2+q]==0){ 59 | temp=1; 60 | } 61 | } 62 | if(kenel[p][q]==-1){ 63 | temp=1; 64 | } 65 | last=last+temp; 66 | } 67 | } 68 | if (last==w*h){ 69 | tempG[i][j]=thisG[i][j]; 70 | } 71 | } 72 | } 73 | return tempG; 74 | } 75 | } -------------------------------------------------------------------------------- /DP/imageProcessor/HoughTransform.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | public class HoughTransform { 3 | public int [][]HTMatrix; 4 | public void HoughTransformLoop(int[][] g, int pix,int scale) { 5 | // TODO Auto-generated method stub 6 | for(int i=0;i=max) { 27 | max=temp; 28 | } 29 | } 30 | } 31 | } 32 | HTMatrix=new int[max+1][360]; 33 | for(int p=0;p<360;p++) { 34 | for(int psita=0;psita input[x][y]) { 17 | output[x][y] = 255; 18 | } 19 | } 20 | } 21 | return output; 22 | } 23 | public int[][] backwardPassMask(int [][]input, int range, int scale){ 24 | int[][] output= new int[input[0].length][input.length]; 25 | for(int x= 0; x< input[0].length; x++) { 26 | for(int y= input.length - 1; y > 0; y--) { 27 | int sum= 0; 28 | for(int z= -range/2; z< range/2; z++) { 29 | sum+= input[x+ z][y- 1]; 30 | } 31 | if(sum/scale > input[x][y]) { 32 | output[x][y]= 255; 33 | } 34 | } 35 | } 36 | return output; 37 | } 38 | } -------------------------------------------------------------------------------- /DP/imageProcessor/Mask.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import java.io.IOException; 3 | public class Mask { 4 | public int[][] Processor(int[][] mag,int[][]dir) throws IOException { 5 | for(int i= 0;i< mag.length; i++){ 6 | for(int j= 0;j< mag[0].length; j++){ 7 | if (mag[i][j]== 0){ 8 | dir[i][j]= 0; 9 | } 10 | } 11 | } 12 | return dir; 13 | } 14 | } -------------------------------------------------------------------------------- /DP/imageProcessor/Median.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import java.awt.image.BufferedImage; 3 | import java.io.IOException; 4 | public class Median { 5 | public int[][] Processor(int[][] g,int d,int e) throws IOException { 6 | int[][] refG = new Reflection().PadImage(g, d, e); 7 | int[] neib=new int[d*e];//for sort 8 | for(int i= d/2;i< g.length+ d/ 2; i++){ 9 | for(int j= e/ 2; j< g[0].length+ e/ 2; j++) { 10 | int q= 0; 11 | for(int k= 0; k< d; k++) { 12 | for(int l= 0; l< e; l++) { 13 | //find 3*3 14 | neib[q++]= refG[i+ k- d/ 2][j+ l- e/ 2]; 15 | //sort 3*3 bbsort 16 | }} 17 | for(int o= 0; o<9; o++) { 18 | for(int p= 0; p< 9; p++){ 19 | if (neib[o]> neib[p]) { 20 | int temp= neib[o]; 21 | neib[o]= neib[p]; 22 | neib[p]= temp; 23 | } 24 | } 25 | } 26 | //get median 27 | g[i- d/ 2][j- e/ 2]= neib[(d* e)/ 2];// 4 is middle valueof sort 9 28 | } 29 | } 30 | return new CheckRange().Processor(g); 31 | } 32 | 33 | public BufferedImage Processor(BufferedImage lygimage, int d, int e) throws IOException { 34 | //image to r[][] g[][] b[][] 35 | //r[][] 36 | //g[][] 37 | //b[][] 38 | //r[][]g[][]b[][] to image 39 | //image to r[][] g[][] b[][] 40 | int r[][]=new ReadWritePng().REDpngRead(lygimage); 41 | int g[][]=new ReadWritePng().GRNpngRead(lygimage); 42 | int b[][]=new ReadWritePng().BLUpngRead(lygimage); 43 | //r[][] 44 | r=Processor(r,d,e); 45 | //g[][] 46 | g=Processor(g,d,e); 47 | //b[][] 48 | b=Processor(b,d,e); 49 | //r[][]g[][]b[][] to image 50 | lygimage=new ReadWritePng().createBufferImage(r,g,b); 51 | return lygimage; 52 | } 53 | } -------------------------------------------------------------------------------- /DP/imageProcessor/Opening.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | public class Opening { 3 | public int[][] Processor(int[][]g,int[][]kenel){ 4 | int[][] opening= new Erosion().Processor(g,kenel); 5 | opening= new Dilation().Processor(opening, kenel); 6 | return opening; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /DP/imageProcessor/PrintMoments.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | public class PrintMoments{ 3 | public void PrintCurrent(int[][]g,int pix) { 4 | double m00= 0,m01= 0,m02= 0,m10= 0,m11= 0,m20= 0; 5 | double p00= 0,p01= 0,p02= 0,p10= 0,p11= 0,p20= 0; 6 | for(int q= 0; q< g.length; q++){ 7 | for(int p= 0; p< g[0].length; p++){ 8 | if(g[q][p]== pix){ 9 | m00= m00+ Math.pow(q, 0)* Math.pow(p, 0); 10 | m01= m01+ Math.pow(q, 0)* Math.pow(p, 1); 11 | m02= m02+ Math.pow(q, 0)* Math.pow(p, 2); 12 | m10= m10+ Math.pow(q, 1)* Math.pow(p, 0); 13 | m11= m11+ Math.pow(q, 1)* Math.pow(p, 1); 14 | m20= m20+ Math.pow(q, 2)* Math.pow(p, 0); 15 | } 16 | } 17 | } 18 | double mean_x= m10/m00, mean_y=m01/m00; 19 | for(int q= 0; q< g.length; q++){ 20 | for(int p= 0; p< g[0].length; p++){ 21 | if(g[q][p]== pix){ 22 | p00= (p00+ Math.pow(q-mean_x, 0)* Math.pow(p-mean_y, 0)); 23 | p01= (p01+ Math.pow(q-mean_x, 0)* Math.pow(p-mean_y, 1)); 24 | p02= (p02+ Math.pow(q-mean_x, 0)* Math.pow(p-mean_y, 2)); 25 | p10= (p10+ Math.pow(q-mean_x, 1)* Math.pow(p-mean_y, 0)); 26 | p11= (p11+ Math.pow(q-mean_x, 1)* Math.pow(p-mean_y, 1)); 27 | p20= (p20+ Math.pow(q-mean_x, 2)* Math.pow(p-mean_y, 0)); 28 | } 29 | } 30 | } 31 | System.out.println("region--->"+pix); 32 | System.out.println("p00------>"+p00); 33 | System.out.println("p01------>"+p01); 34 | System.out.println("p02------>"+p02); 35 | System.out.println("p10------>"+p10); 36 | System.out.println("p11------>"+p11); 37 | System.out.println("p20------>"+p20); 38 | } 39 | } -------------------------------------------------------------------------------- /DP/imageProcessor/ReadWritePng.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import java.awt.image.BufferedImage; 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import javax.imageio.ImageIO; 7 | public class ReadWritePng { 8 | public int h; 9 | public int w; 10 | public void writePNG(String args, int[][] outmag) throws IOException{ 11 | BufferedImage image= new BufferedImage(outmag[0].length, outmag.length 12 | , BufferedImage.TYPE_INT_RGB); 13 | for (int i= 0; i< image.getHeight(); ++i) { 14 | for (int j= 0; j< image.getWidth(); ++j) { 15 | int val= (int) outmag[i][j]; 16 | int pixel= (val<< 16) | (val<< 8) | (val); 17 | image.setRGB(j, i, pixel); 18 | } 19 | } 20 | String pathBin= args;//output path 21 | File outputBin= new File(pathBin); 22 | ImageIO.write(image, "png", outputBin); 23 | } 24 | 25 | public ReadWritePng(){ 26 | } 27 | 28 | public int[][] GRNpngRead(String args) throws IOException { 29 | BufferedImage image= ImageIO.read(new File(args)); 30 | // extract R, G, B values 31 | h= image.getHeight(); 32 | w= image.getWidth(); 33 | System.out.println(h+"&&"+w); 34 | int[][] g= new int[h][w]; 35 | for (int i= 0; i< h; i++){ 36 | for (int j= 0; j< w; j++){ 37 | g[i][j]= image.getRGB(j, i)>> 8& 0xFF; 38 | } 39 | } 40 | return g; 41 | } 42 | 43 | public int[][] GRNpngRead(BufferedImage image) throws IOException { 44 | // extract R, G, B values 45 | h= image.getHeight(); 46 | w= image.getWidth(); 47 | System.out.println(h+"&&"+w); 48 | int[][] g= new int[h][w]; 49 | for (int i= 0; i< h; i++){ 50 | for (int j= 0; j< w; j++){ 51 | g[i][j]= image.getRGB(j, i)>> 8& 0xFF; 52 | } 53 | } 54 | return g; 55 | } 56 | 57 | public int[][] REDpngRead(String args) throws IOException { 58 | BufferedImage image = ImageIO.read(new File(args)); 59 | // extract R, G, B values 60 | h= image.getHeight(); 61 | w= image.getWidth(); 62 | int[][] r= new int[h][w]; 63 | for (int i= 0; i< h; i++){ 64 | for (int j= 0; j< w; j++){ 65 | r[i][j]= image.getRGB(j, i)>> 16 & 0xFF;//x,y coordinates opposite to array 66 | } 67 | } 68 | return r; 69 | } 70 | 71 | public int[][] REDpngRead(BufferedImage image) throws IOException { 72 | // extract R, G, B values 73 | h= image.getHeight(); 74 | w= image.getWidth(); 75 | int[][] r= new int[h][w]; 76 | for (int i= 0; i< h; i++){ 77 | for (int j= 0; j< w; j++){ 78 | r[i][j]= image.getRGB(j, i)>> 16 & 0xFF;//x,y coordinates opposite to array 79 | } 80 | } 81 | return r; 82 | } 83 | 84 | public int[][] BLUpngRead(String args) throws IOException { 85 | BufferedImage image= ImageIO.read(new File(args)); 86 | // extract R, G, B values 87 | h= image.getHeight(); 88 | w= image.getWidth(); 89 | int[][] b= new int[h][w]; 90 | for (int i= 0; i< h; i++){ 91 | for (int j= 0; j< w; j++){ 92 | b[i][j]= image.getRGB(j, i)& 0xFF; 93 | } 94 | } 95 | return b; 96 | } 97 | 98 | public int[][] BLUpngRead(BufferedImage image) throws IOException { 99 | // extract R, G, B values 100 | h= image.getHeight(); 101 | w= image.getWidth(); 102 | int[][] b= new int[h][w]; 103 | for (int i= 0; i< h; i++){ 104 | for (int j= 0; j< w; j++){ 105 | b[i][j]= image.getRGB(j, i)& 0xFF; 106 | } 107 | } 108 | return b; 109 | } 110 | 111 | public int[] sizeHW(String args) throws IOException { 112 | BufferedImage image= ImageIO.read(new File(args)); 113 | int size[]= new int[2]; 114 | size[0]= image.getHeight(); 115 | size[1]= image.getWidth(); 116 | return size; 117 | } 118 | 119 | public BufferedImage createBufferImage(int[][] r, int[][] g, int[][] b) { 120 | BufferedImage image= new BufferedImage(r[0].length, r.length, BufferedImage.TYPE_INT_RGB); 121 | for (int i= 0; i< image.getHeight(); ++i) { 122 | for (int j1= 0; j1 < image.getWidth(); ++j1) { 123 | int rr= (int) r[i][j1]; 124 | int gg= (int) g[i][j1]; 125 | int bb= (int) b[i][j1]; 126 | int pixel= (rr<< 16)| (gg<< 8)| (bb); 127 | image.setRGB(j1, i, pixel); 128 | } 129 | } 130 | return image; 131 | } 132 | } -------------------------------------------------------------------------------- /DP/imageProcessor/Reflection.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | public class Reflection { 3 | public int[][] PadImage (int[][] _image, int height, int width){ 4 | int lines= _image.length; 5 | int samples= _image[0].length; 6 | int padded_lines= lines+ height- 1; 7 | int padded_samples= samples+ width- 1; 8 | int[][] paddedImage= new int[padded_lines][padded_samples]; 9 | int halfWidth= width/ 2; 10 | int halfHeight= height/ 2; 11 | // -- Fill interior of padded array with actual image. 12 | for (int i= 0; i< lines;++i) { 13 | for (int j= 0; j< samples;++j) { 14 | paddedImage[i+ halfHeight][j+ halfWidth]= _image[i][j]; 15 | } 16 | } 17 | // -- Fill border of padded array with a mirror image of 18 | // the actual image reflected about the boundaries. 19 | // left border 20 | for (int i= 0; i< lines; ++i) { 21 | for (int j= 0, oj= halfWidth- 1; j< (int)halfWidth; ++j, --oj) { 22 | paddedImage[i+ halfHeight][oj]= _image[i][j]; 23 | } 24 | } 25 | // right border 26 | for (int i= 0; i< lines; ++i) { 27 | for (int j= samples- halfWidth, oj= samples+ (2* halfWidth)- 1; j< samples; ++j, --oj) { 28 | paddedImage[i+ halfHeight][oj]= _image[i][j]; 29 | } 30 | } 31 | // top border 32 | for (int i= 0, oi= halfHeight - 1; i< (int)halfHeight; ++i, --oi) { 33 | for (int j= 0; j< samples; ++j) { 34 | paddedImage[oi][j+ halfWidth]= _image[i][j]; 35 | } 36 | } 37 | // bottom border 38 | for (int i= lines - halfHeight, oi= lines+ (2* halfHeight) - 1; i< lines;++i, --oi) { 39 | for (int j= 0; j< samples; ++j) { 40 | paddedImage[oi][j+ halfWidth]= _image[i][j]; 41 | } 42 | } 43 | // top left corner 44 | for (int i= 0; i< (int)halfHeight; ++i) { 45 | for (int j= 0, oj= halfWidth- 1; j< (int)halfWidth; ++j, --oj) { 46 | paddedImage[i][oj]= paddedImage[i][j+ halfWidth]; 47 | } 48 | } 49 | // bottom right corner 50 | for (int i= lines+ halfHeight; i< lines+ (2* halfHeight); ++i) { 51 | for (int j= samples, oj= samples+ (2* halfWidth) - 1; j< samples+ halfWidth; ++j, --oj) { 52 | paddedImage[i][oj]= paddedImage[i][j]; 53 | } 54 | } 55 | // top right corner 56 | for (int i= 0; i< (int)halfHeight; ++i) { 57 | for (int j= samples, oj= samples+ (2* halfWidth)- 1; j< samples+ halfWidth; ++j, --oj) { 58 | paddedImage[i][oj]= paddedImage[i][j]; 59 | } 60 | } 61 | // bottom left corner 62 | for (int i= lines+ halfHeight; i< lines+ (2* halfHeight); ++i) { 63 | for (int j= 0, oj= halfWidth - 1; j< (int)halfWidth; ++j, --oj) { 64 | paddedImage[i][oj]= paddedImage[i][j+ halfWidth]; 65 | } 66 | } 67 | return paddedImage; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /DP/imageProcessor/RegionGet.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import imageProcessor.ReadWritePng; 3 | 4 | import java.io.IOException; 5 | public class RegionGet { 6 | int[] pix; 7 | public int []new_region; 8 | public int scale; 9 | public RegionGet(int[][] g) throws IOException{ 10 | int n= 0; 11 | pix= new int[256]; 12 | for (int i= 0; i< g.length; i++){ 13 | for(int j= 0; j< g[0].length; j++) { 14 | pix[g[i][j]] ++; 15 | } 16 | } 17 | for(int i= 0; i< 256; i++){ 18 | if(pix[i]> 0){ 19 | n++; 20 | } 21 | } 22 | System.out.println(n); 23 | new_region= new int[n]; 24 | n= 0; 25 | for(int i= 0; i< 256; i++){ 26 | if(pix[i]> 0) { 27 | new_region[n++]= i; 28 | } 29 | } 30 | System.out.println("value"+ n); 31 | scale= new_region.length- 1; 32 | //return new_region; 33 | } 34 | public void buildGraph(int[][] g,String output) throws IOException{ 35 | int[][]temp= new int[g.length][g[0].length]; 36 | for(int q= 0; q 255){ 43 | outdir[i][j]= 255; 44 | } 45 | } 46 | } 47 | return new CheckRange().Processor(outdir); 48 | } 49 | } -------------------------------------------------------------------------------- /DP/imageProcessor/Strech.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | import java.awt.image.BufferedImage; 3 | import java.io.IOException; 4 | public class Strech { 5 | public int[][] Processor(int[][] g,double d,double e) throws IOException { 6 | int histgram[] = new int[256]; 7 | for (int i = 0; i < g.length; i++) { 8 | for (int j = 0; j < g[0].length; j++) { 9 | ++histgram[g[i][j]]; 10 | } 11 | } 12 | float p = 0; 13 | int br = 0,dr = 0; 14 | for(int i=0;i<256;i++) { 15 | p=p+histgram[i]; 16 | if(p > d* g.length*g[0].length){ 17 | dr=i; 18 | break; 19 | } 20 | } 21 | System.out.println("dr:"+dr); 22 | p = 0; 23 | for(int i=0;i<256;i++){ 24 | p=p+histgram[i]; 25 | if(p > e* g.length*g[0].length){ 26 | br=i; 27 | break; 28 | } 29 | } 30 | System.out.println("br:"+br); 31 | int out[][] = new int[g.length][g[0].length]; 32 | for (int i = 0; i < g.length; i++) { 33 | for (int j = 0; j < g[0].length; j++) { 34 | out[i][j]=(g[i][j]-dr)*255/(br-dr); 35 | } 36 | } 37 | return new CheckRange().Processor(out); 38 | } 39 | public BufferedImage Processor(BufferedImage lygimage, double d, double e) throws IOException { 40 | //image to r[][] g[][] b[][] 41 | //r[][] 42 | //g[][] 43 | //b[][] 44 | //r[][]g[][]b[][] to image 45 | //image to r[][] g[][] b[][] 46 | int r[][]=new ReadWritePng().REDpngRead(lygimage); 47 | int g[][]=new ReadWritePng().GRNpngRead(lygimage); 48 | int b[][]=new ReadWritePng().BLUpngRead(lygimage); 49 | //r[][] 50 | r=Processor(r,d,e); 51 | //g[][] 52 | g=Processor(g,d,e); 53 | //b[][] 54 | b=Processor(b,d,e); 55 | //r[][]g[][]b[][] to image 56 | lygimage=new ReadWritePng().createBufferImage(r,g,b); 57 | return lygimage; 58 | } 59 | } -------------------------------------------------------------------------------- /DP/imageProcessor/Threshold.java: -------------------------------------------------------------------------------- 1 | package imageProcessor; 2 | public class Threshold { 3 | public int[][] Processor (int[][] g,int Td){ 4 | // -- prepare output image for subtract the mean 5 | for (int i = 0; i Td){ 8 | g[i][j]=255; 9 | } 10 | else{ 11 | g[i][j] = 0; // sho 12 | } 13 | } 14 | } 15 | return g; 16 | } 17 | } -------------------------------------------------------------------------------- /DP/mapProcessor/VtoV.java: -------------------------------------------------------------------------------- 1 | package mapProcessor; 2 | import java.lang.reflect.Type; 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import org.json.JSONArray; 7 | import org.json.JSONObject; 8 | import org.json.XML; 9 | import com.google.gson.Gson; 10 | import com.google.gson.reflect.TypeToken; 11 | public class VtoV{ 12 | public static JSONObject XmlToJsonObject(String response ){ 13 | JSONObject responseJson = XML.toJSONObject(response); 14 | return responseJson; 15 | } 16 | public static Map JsonObjectToMap(JSONObject response ){ 17 | Gson gson = new Gson(); 18 | Type type = new TypeToken>(){}.getType(); 19 | Map responseMap = gson.fromJson(response.toString(), type); 20 | return responseMap; 21 | } 22 | public static String MapToJsonString(Map response ){ 23 | Gson gson = new Gson(); 24 | return gson.toJson(response); 25 | } 26 | public static String ListToJsonString(List response ){ 27 | Gson gson = new Gson(); 28 | return gson.toJson(response); 29 | } 30 | public static String ObjectToJsonString(Object response ){ 31 | Gson gson = new Gson(); 32 | return gson.toJson(response); 33 | } 34 | public static Map XmlToMap(String response){ 35 | JSONObject responseJson = XML.toJSONObject(response); 36 | Gson gson = new Gson(); 37 | Type type = new TypeToken>(){}.getType(); 38 | Map responseMap =gson.fromJson(responseJson.toString(), type); 39 | return responseMap; 40 | } 41 | public static String MapToXml(Map response){ 42 | Gson gson = new Gson(); 43 | String json = gson.toJson(response); 44 | JSONObject jsonObj = new JSONObject(json); 45 | String xml = XML.toString(jsonObj); 46 | return xml; 47 | } 48 | public static List JsonArrayToList(JSONArray jobj) { 49 | List output = new ArrayList<>(); 50 | for(int i=0; i0;i--,j++){ 38 | array[j]=r.nextInt(999999); 39 | //System.out.println(array[j]); 40 | } 41 | // TODO Auto-generated method stub 42 | return array; 43 | } 44 | } -------------------------------------------------------------------------------- /DP/searchProcessor/DepthRun.java: -------------------------------------------------------------------------------- 1 | package searchProcessor; 2 | import sortProcessor.Leaf; 3 | //import com.sun.image.codec.jpeg.JPEGCodec; 4 | //import com.sun.image.codec.jpeg.JPEGImageDecoder; 5 | public class DepthRun extends Thread{ 6 | public boolean result; 7 | Leaf temp1; 8 | int n; 9 | public boolean end=false; 10 | public DepthRun(Leaf root, int n1) { 11 | temp1=root; 12 | n=n1; 13 | } 14 | 15 | @Override 16 | public void run(){ 17 | result= false; 18 | check(temp1); 19 | end= true; 20 | } 21 | 22 | private void check(Leaf temp) { 23 | if(temp!= null){ 24 | if(temp.sort== 0){ 25 | if(temp.hasO1== 1){ 26 | if(n== temp.value[0]){ 27 | result= true; 28 | end= true; 29 | } 30 | 31 | } 32 | if(temp.hasO2== 1){ 33 | if(n== temp.value[1]){ 34 | result= true; 35 | end= true; 36 | } 37 | } 38 | if(temp.hasO3== 1){ 39 | if(n== temp.value[2]){ 40 | result= true; 41 | end= true; 42 | } 43 | } 44 | if(temp.hasO4== 1){ 45 | if(n== temp.value[3]){ 46 | result= true; 47 | end= true; 48 | } 49 | } 50 | if(temp.hasO5== 1){ 51 | if(n== temp.value[4]){ 52 | result= true; 53 | end= true; 54 | } 55 | } 56 | if(temp.hasO6== 1){ 57 | if(n== temp.value[5]){ 58 | result= true; 59 | end= true; 60 | } 61 | } 62 | if(temp.hasO7== 1){ 63 | if(n== temp.value[6]){ 64 | result= true; 65 | end= true; 66 | } 67 | } 68 | temp.sort= 1; 69 | if(temp.O1!= null&&temp.O1.sort== 0) 70 | check(temp.O1); 71 | if(temp.O2!= null&&temp.O2.sort== 0) 72 | check(temp.O2); 73 | if(temp.O3!= null&&temp.O3.sort== 0) 74 | check(temp.O3); 75 | if(temp.O4!= null&&temp.O4.sort== 0) 76 | check(temp.O4); 77 | if(temp.O5!= null&&temp.O5.sort== 0) 78 | check(temp.O5); 79 | if(temp.O6!= null&&temp.O6.sort== 0) 80 | check(temp.O6); 81 | if(temp.O7!= null&&temp.O7.sort== 0) 82 | check(temp.O7); 83 | if(temp.O8!= null&&temp.O8.sort== 0) 84 | check(temp.O8); 85 | } 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /DP/searchProcessor/DepthTreeSearch.java: -------------------------------------------------------------------------------- 1 | package searchProcessor; 2 | import sortProcessor.Leaf; 3 | public class DepthTreeSearch{ 4 | public boolean search(Leaf root,int n1) { 5 | DepthRun pr=new DepthRun(root,n1); 6 | Thread t=new Thread(pr); 7 | t.run(); 8 | while(true) { 9 | if(pr.end){ 10 | break; 11 | } 12 | } 13 | boolean ans=pr.result; 14 | t=null; 15 | pr=null; 16 | return ans; 17 | } 18 | } -------------------------------------------------------------------------------- /DP/searchProcessor/LinerSearch.java: -------------------------------------------------------------------------------- 1 | package searchProcessor; 2 | public class LinerSearch{ 3 | public boolean search(int [] array,int n) { 4 | for(int i=0; iarray[j+ 1]){ 7 | int temp= array[j]; 8 | array[j]= array[j+ 1]; 9 | array[j+ 1]= temp; 10 | } 11 | } 12 | return array; 13 | } 14 | 15 | public int[] sort(int [] array,int n) { 16 | for(int i=0; i array[j+ 1]){ 19 | int temp= array[j]; 20 | array[j]= array[j+ 1]; 21 | array[j+ 1]= temp; 22 | } 23 | } 24 | return array; 25 | } 26 | } -------------------------------------------------------------------------------- /DP/sortProcessor/BTreeSort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class BTreeSort{ 3 | public Leaf root; 4 | public Leaf heap; 5 | int c; 6 | int a1[]; 7 | public int[] sort(int [] a) { 8 | //make tree 9 | c= 0; 10 | a1= new int[a.length]; 11 | if(root== null){ 12 | root= new Leaf(); 13 | root.value[0]= a[0]; 14 | root.hasO1= 1; 15 | } 16 | for(int i= 1; i< a.length; i++){ 17 | heap= root; 18 | addleaf(a[i]); 19 | } 20 | heap= root; 21 | check(heap); 22 | return a1; 23 | } 24 | private void check(Leaf temp) { 25 | // TODO Auto-generated method stub 26 | if(temp!= null){ 27 | check(temp.O1); 28 | a1[c]= temp.value[0]; 29 | c+= 1; 30 | check(temp.O2); 31 | } 32 | } 33 | private void addleaf(int i) { 34 | if(i<= heap.value[0]){ 35 | if(null== heap.O1){ 36 | heap.O1= new Leaf(); 37 | heap= heap.O1; 38 | heap.value[0]= i; 39 | root.hasO1= 1; 40 | return; 41 | } 42 | else{ 43 | heap= heap.O1; 44 | addleaf(i); 45 | } 46 | } 47 | else{ 48 | if(heap.O2== null){ 49 | heap.O2= new Leaf(); 50 | heap= heap.O2; 51 | heap.value[0]= i; 52 | root.hasO1= 1; 53 | return; 54 | }else{ 55 | heap= heap.O2; 56 | addleaf(i); 57 | } 58 | } 59 | } 60 | public Leaf root(int[] a) { 61 | if(root== null){ 62 | root= new Leaf(); 63 | root.value[0]= a[0]; 64 | root.hasO1= 1; 65 | }for(int i=1; i a[j]){ 14 | s= a[j]; 15 | ps= j; 16 | fs= 1; 17 | } 18 | if(b< a[j]){ 19 | b= a[j]; 20 | pb= j; 21 | fb= 1; 22 | } 23 | } 24 | if(fs== 1){ 25 | fs= 0; 26 | int temp= a[i]; 27 | a[i]= s; 28 | a[ps]= temp; 29 | } 30 | if(fb== 1){ 31 | int temp= a[e-1]; 32 | a[e-1]= b; 33 | a[pb]= temp; 34 | } 35 | } 36 | return a; 37 | } 38 | } -------------------------------------------------------------------------------- /DP/sortProcessor/Compare.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Compare.java -------------------------------------------------------------------------------- /DP/sortProcessor/Demo.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Demo.java -------------------------------------------------------------------------------- /DP/sortProcessor/Heap_1D_Sort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class Heap_1D_Sort{ 3 | int a[], s; 4 | public int[] sort(int [] array) { 5 | a= new int[array.length+ 1]; 6 | s= array.length; 7 | for(int i=1; i 1){ 11 | int t=a[1]; a[1]=a[s]; a[s]=t; 12 | s-= 1; 13 | find(1); 14 | } 15 | for(int i=1; i s) 24 | {find(il);} 25 | else if(ir<= s&&il> s) 26 | {find(ir);} 27 | if(il<= s) 28 | if((a[il]>a[i])) 29 | {t=a[i];a[i]=a[il];a[il]=t;find(il);} 30 | if(ir<= s) 31 | if((a[ir]>a[i])) 32 | {t=a[i];a[i]=a[ir];a[ir]=t;find(ir);} 33 | } 34 | } -------------------------------------------------------------------------------- /DP/sortProcessor/Heap_2D_Sort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class Heap_2D_Sort { 3 | int[] sort(int[] data){ 4 | int startIndex = getParentIndex(data.length - 1); 5 | for (int i = startIndex; i >= 0; i--) { 6 | maxHeapify(data, data.length, i); 7 | } 8 | heapSort(data); 9 | return data; 10 | } 11 | private void maxHeapify(int[] data, int heapSize, int index){ 12 | int left = getChildLeftIndex(index); 13 | int right = getChildRightIndex(index); 14 | 15 | int largest = index; 16 | if (left < heapSize && data[index] < data[left]) { 17 | largest = left; 18 | } 19 | if (right < heapSize && data[largest] < data[right]) { 20 | largest = right; 21 | } 22 | if (largest != index) { 23 | int temp = data[index]; 24 | data[index] = data[largest]; 25 | data[largest] = temp; 26 | maxHeapify(data, heapSize, largest); 27 | } 28 | } 29 | private void heapSort(int[] data){ 30 | for (int i = data.length - 1; i > 0; i--) { 31 | int temp = data[0]; 32 | data[0] = data[i]; 33 | data[i] = temp; 34 | maxHeapify(data, i, 0); 35 | } 36 | } 37 | private int getParentIndex(int current){ 38 | return (current - 1) >> 1; 39 | } 40 | 41 | private int getChildLeftIndex(int current){ 42 | return (current << 1) + 1; 43 | } 44 | 45 | private int getChildRightIndex(int current){ 46 | return (current << 1) + 2; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /DP/sortProcessor/InsertionSort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class InsertionSort{ 3 | public int[] sort(int [] array) { 4 | int j; 5 | for(int i=1;i=1){ 8 | if(array[j]=1){ 24 | if(array[j] array = new ArrayList(); 8 | public void sort(double [] a) { 9 | array.add(a[0]); 10 | if(a[1] > a[0]) { 11 | array.add(1, a[1]); 12 | }else { 13 | array.add(0, a[1]); 14 | } 15 | if(a[2] < a[0]) { 16 | array.add(0, a[2]); 17 | }else if(a[2] > a[1]) { 18 | array.add(2, a[2]); 19 | }else { 20 | array.add(1, a[2]); 21 | } 22 | for(int i = 3; i < a.length; i++) { 23 | bsa(a[i], 0, array.size() - 1); 24 | } 25 | } 26 | 27 | private void bsa(double a, int l, int r) { 28 | int m = (l + r) >> 1; 29 | if(m != l) { 30 | if(a <= array.get(m)){ 31 | bsa(a, l, m); 32 | }else { 33 | bsa(a, m, r); 34 | } 35 | } else if(m == l){ 36 | if(a <= array.get(m)){ 37 | array.add(l, a); 38 | }else if(a > array.get(m) && a <= array.get(r) ){ 39 | array.add(l+1, a); 40 | }else { 41 | array.add(l+2, a); 42 | } 43 | } 44 | } 45 | 46 | public static void main(String agrs[]) { 47 | int c=99999; 48 | double [] a = new double[c]; 49 | java.util.Random r=new java.util.Random(); 50 | for(int i=0;i=heap.value&&i<=heap.next.value){ 39 | node temp=new node(); 40 | temp.value=i; 41 | temp.next=heap.next; 42 | heap.next=temp; 43 | return; 44 | } 45 | heap=heap.next; 46 | } 47 | node temp=new node(); 48 | heap.next=temp; 49 | temp.value=i; 50 | return; 51 | } 52 | } -------------------------------------------------------------------------------- /DP/sortProcessor/MergeSort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class MergeSort{ 3 | public int[] sort(int [] array) { 4 | int mid; 5 | int l=0; 6 | int h=array.length-1; 7 | if(lheap.value[0] && i<=heap.value[1]){ 119 | if(heap.O2==null){ 120 | heap.O2=new Leaf(); 121 | heap.O2.value[0]=i; 122 | heap.O2.hasO1=1; 123 | return; 124 | }else{ 125 | heap=heap.O2; 126 | addleaf(i); 127 | } 128 | } 129 | else if(i>heap.value[1] && i<=heap.value[2]){ 130 | if(heap.O3==null){ 131 | heap.O3=new Leaf(); 132 | heap.O3.value[0]=i; 133 | heap.O3.hasO1=1; 134 | return; 135 | }else{ 136 | heap=heap.O3; 137 | addleaf(i); 138 | } 139 | } 140 | else if(i>heap.value[2] && i<=heap.value[3]){ 141 | if(heap.O4==null){ 142 | heap.O4=new Leaf(); 143 | heap.O4.value[0]=i; 144 | heap.O4.hasO1=1; 145 | return; 146 | }else{ 147 | heap=heap.O4; 148 | addleaf(i); 149 | } 150 | } 151 | else if(i>heap.value[3] && i<=heap.value[4]){ 152 | if(heap.O5==null){ 153 | heap.O5=new Leaf(); 154 | heap.O5.value[0]=i; 155 | heap.O5.hasO1=1; 156 | return; 157 | }else{ 158 | heap=heap.O5; 159 | addleaf(i); 160 | } 161 | } 162 | else if(i>heap.value[4] && i<=heap.value[5]){ 163 | if(heap.O6==null){ 164 | heap.O6=new Leaf(); 165 | heap.O6.value[0]=i; 166 | heap.O6.hasO1=1; 167 | return; 168 | }else{ 169 | heap=heap.O6; 170 | addleaf(i); 171 | } 172 | 173 | } 174 | else if(i>heap.value[5] && i<=heap.value[6]){ 175 | if(heap.O7==null){ 176 | heap.O7=new Leaf(); 177 | heap.O7.value[0]=i; 178 | heap.O7.hasO1=1; 179 | return; 180 | }else{ 181 | heap=heap.O7; 182 | addleaf(i); 183 | } 184 | } 185 | else{ 186 | if(heap.O8==null){ 187 | heap.O8=new Leaf(); 188 | heap.O8.value[0]=i; 189 | heap.O8.hasO1=1; 190 | return; 191 | }else{ 192 | heap=heap.O8; 193 | addleaf(i); 194 | } 195 | } 196 | } 197 | } 198 | } -------------------------------------------------------------------------------- /DP/sortProcessor/OrderEvenSort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class OrderEvenSort{ 3 | public int[] sort(int [] array) { 4 | boolean sorted = false; 5 | while(!sorted){ 6 | sorted=true; 7 | for(int i = 1; i < array.length-1; i += 2) { 8 | if(array[i] > array[i+1]) { 9 | swap(array,i, i+1); 10 | sorted = false; 11 | } 12 | } 13 | 14 | for(int i = 0; i < array.length-1; i += 2){ 15 | if(array[i] > array[i+1]) { 16 | swap(array, i, i+1); 17 | sorted = false; 18 | } 19 | } 20 | } 21 | 22 | 23 | 24 | return array; 25 | } 26 | 27 | private void swap(int[] array, int i, int j) { 28 | // TODO Auto-generated method stub 29 | int temp=array[i]; 30 | array[i]=array[j]; 31 | array[j]=temp; 32 | } 33 | } -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_1D_Sort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class Quick_1D_Sort{ 3 | public int[] sort(int [] a) { 4 | int lp=0; 5 | int rp=a.length-1; 6 | while(lpa[rp]){ 15 | int temp=a[lp]; 16 | a[lp]=a[rp]; 17 | a[rp]=temp; 18 | } 19 | rp-=1; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_2D_Sort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class Quick_2D_Sort{ 3 | public int[] sort(int [] a) { 4 | int v=(int) Math.log(a.length); 5 | for(int i=0;il) 14 | { 15 | sort(a,l,m); 16 | sort(a,m,r); 17 | } 18 | } 19 | 20 | private void quick(int[] a, int l, int r) { 21 | while(la[r]){ 23 | int temp=a[l]; 24 | a[l]=a[r]; 25 | a[r]=temp; 26 | } 27 | l++; 28 | r--; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_3D_Sort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | 3 | public class Quick_3D_Sort{ 4 | public int[] sort(int [] a) { 5 | int pos[]=new int[1]; 6 | int lp=0; 7 | int rp=a.length-1; 8 | if(lpx)rp1--; 42 | if(lp1x)rp1--; 36 | if(lp1x)rp1--; 28 | if(lp1y)rp1--; 40 | if(lp1=1+lp){ 21 | if(a[j]=a[rp]){ 38 | x=a[rp]; 39 | } 40 | while(lp1x){ 45 | rp--; 46 | } 47 | if(lp1=1+lp){ 66 | if(Double.valueOf(a[j][1])=Double.valueOf(a[rp][1])){ 85 | x=a[rp]; 86 | } 87 | while(lp1Double.valueOf(x[1])){ 92 | rp1--; 93 | } 94 | if(lp1=1+lp){ 16 | if(x[j]>1); 27 | if(len>7){ 28 | int l=p; 29 | int n=p+len-1; 30 | if(len>40){ 31 | int s = len/8; 32 | l=med3(x,l,l+s,l+2*s); 33 | m=med3(x,m-s,m,m+s); 34 | n=med3(x,n-2*s,n-s,n); 35 | } 36 | m=med3(x,l,m,n); 37 | } 38 | int v=x[m]; 39 | int a=p,b=a,c=p+len-1,d=c; 40 | while(true){ 41 | while(b<=c&&x[b]<=v){ 42 | if(x[b]==v) 43 | swap(x,a++,b); 44 | b++; 45 | } 46 | while(c>=b&&x[c]>=v){ 47 | if(x[c]==v) 48 | swap(x,c,d--); 49 | c--; 50 | } 51 | if(b>c) 52 | break; 53 | swap(x,b++,c--); 54 | } 55 | int s,n=p+len; 56 | s=Math.min(a-p, b-a); 57 | vecswap(x,p,b-s,s); 58 | s=Math.min(d-c,n-d-1); 59 | vecswap(x,b,n-s,s); 60 | if((s=b-a)>1) 61 | quick2d(x,p,s+p-1); 62 | if((s=d-c)>1) 63 | quick2d(x,n-s,n-1); 64 | } } 65 | } 66 | 67 | private void vecswap(int[] x, int a, int b, int n) { 68 | for(int i=0;ix[c]?b:x[a]>x[c]?c:a; 87 | } 88 | } -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_Luoyaoguang_1D.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Quick_Luoyaoguang_1D.java -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_Luoyaoguang_2D.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Quick_Luoyaoguang_2D.java -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_Luoyaoguang_3D.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Quick_Luoyaoguang_3D.java -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_Luoyaoguang_4D.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Quick_Luoyaoguang_4D.java -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_Luoyaoguang_4DWithoutComb.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Quick_Luoyaoguang_4DWithoutComb.java -------------------------------------------------------------------------------- /DP/sortProcessor/Quick_Luoyaoguang_5D.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/sortProcessor/Quick_Luoyaoguang_5D.java -------------------------------------------------------------------------------- /DP/sortProcessor/SelectionSort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class SelectionSort{ 3 | public int[] sort(int [] array) { 4 | for(int i=0;iarray[j]){ 7 | int temp=array[i]; 8 | array[i]=array[j]; 9 | array[j]=temp; 10 | } 11 | } 12 | } 13 | return array; 14 | } 15 | } -------------------------------------------------------------------------------- /DP/sortProcessor/ShellSort.java: -------------------------------------------------------------------------------- 1 | package sortProcessor; 2 | public class ShellSort{ 3 | public int[] sort(int [] a) { 4 | for(int i=(a.length-1)/2;i>0;i/=2){ 5 | for(int ii=i;ii=0){ 8 | if(a[iii+i]heap.value[0] && i<=heap.value[1]){ 83 | if(heap.O2==null){ 84 | heap.O2=new Leaf(); 85 | heap=heap.O2; 86 | heap.value[0]=i; 87 | heap.hasO1=1; 88 | return; 89 | }else{ 90 | heap=heap.O2; 91 | addleaf(i); 92 | } 93 | } else{ 94 | if(heap.O3==null){ 95 | heap.O3=new Leaf(); 96 | heap=heap.O3; 97 | heap.value[0]=i; 98 | heap.hasO1=1; 99 | return; 100 | }else{ 101 | heap=heap.O3; 102 | addleaf(i); 103 | } 104 | } 105 | } 106 | } 107 | } -------------------------------------------------------------------------------- /DP/soundProcessor/ButterworthPro.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import java.awt.Dimension; 3 | import java.awt.geom.Line2D; 4 | import java.awt.geom.Line2D.Double; 5 | import java.util.Vector; 6 | import javax.sound.sampled.AudioFormat; 7 | import javax.sound.sampled.AudioInputStream; 8 | public class ButterworthPro{ 9 | Vector lines= new Vector(); 10 | byte[] audioBytes; 11 | AudioFormat af; 12 | AudioInputStream ais; 13 | public double[] audioData = null; 14 | public double []butterworth; 15 | @SuppressWarnings("rawtypes") 16 | public Vector getVectorLines(AudioInputStream ais1){ 17 | ais=ais1; 18 | lines.removeAllElements(); // clear the old vector 19 | af = ais.getFormat(); 20 | audioBytes=null; 21 | if (audioBytes == null) { 22 | try { 23 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 24 | System.out.println("audiobyte length:"+audioBytes.length); 25 | ais.read(audioBytes); 26 | } catch (Exception ex) { 27 | //reportStatus(ex.toString()); 28 | return null; 29 | } 30 | } 31 | Dimension d = new Dimension(800,600); 32 | int w = d.width; 33 | int h = d.height-15; 34 | if (af.getSampleSizeInBits() == 16) { 35 | int nlengthInSamples = audioBytes.length / 2; 36 | audioData = new double[nlengthInSamples]; 37 | if (af.isBigEndian()) { 38 | for (int i = 0; i < nlengthInSamples; i++) { 39 | /* First byte is MSB (high order) */ 40 | int MSB = (int) audioBytes[2*i]; 41 | /* Second byte is LSB (low order) */ 42 | int LSB = (int) audioBytes[2*i+1]; 43 | audioData[i] = MSB << 8 | (255 & LSB); 44 | } 45 | } else { 46 | for (int i = 0; i < nlengthInSamples; i++) { 47 | /* First byte is LSB (low order) */ 48 | int LSB = (int) audioBytes[2*i]; 49 | /* Second byte is MSB (high order) */ 50 | int MSB = (int) audioBytes[2*i+1]; 51 | audioData[i] = MSB << 8 | (255 & LSB); 52 | } 53 | } 54 | } else if (af.getSampleSizeInBits() == 8) { 55 | int nlengthInSamples = audioBytes.length; 56 | audioData = new double[nlengthInSamples]; 57 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 58 | for (int i = 0; i < audioBytes.length; i++) { 59 | audioData[i] = audioBytes[i]; 60 | } 61 | } else { 62 | for (int i = 0; i < audioBytes.length; i++) { 63 | audioData[i] = audioBytes[i] - 128; 64 | } 65 | } 66 | } 67 | System.out.println(audioBytes.length); 68 | System.out.println(af.getFrameSize()); 69 | int []lap=new int[5]; 70 | lap[0]=0; 71 | lap[1]=1; 72 | lap[2]=2; 73 | lap[3]=1; 74 | lap[4]=0; 75 | butterworth=new double[audioData.length]; 76 | double sum=0; 77 | for(int i=2;i>8); 17 | audioBytes[2*i+1]= (byte)((int)guassian2[i]); 18 | // 19 | } 20 | } else { 21 | for (int i = 0; i < guassian2.length; i++) { 22 | //System.out.println(i+"*"+guassian2.length); 23 | audioBytes[2*i]=(byte)((int)guassian2[i]); 24 | audioBytes[2*i+1]= (byte)((int)guassian2[i]>>8); 25 | } 26 | } 27 | } else if (af.getSampleSizeInBits() == 8) { 28 | audioBytes=new byte[guassian2.length]; 29 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 30 | for (int i = 0; i < guassian2.length; i++) { 31 | audioBytes[i]=(byte) guassian2[i]; 32 | } 33 | } else { 34 | for (int i = 0; i < guassian2.length; i++) { 35 | audioBytes[i]=(byte) ((byte) guassian2[i]+128); 36 | } 37 | } 38 | } 39 | //2:bytes to adataFrame 40 | System.out.println("now length-->"+audioBytes.length); 41 | ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); 42 | ais = new AudioInputStream(bais, ais.getFormat(), audioBytes.length / af.getFrameSize()); 43 | return ais; 44 | } 45 | 46 | public AudioInputStream getAIS(double[] guassian2,AudioFormat af,AudioInputStream ais) { 47 | // TODO Auto-generated method stub 48 | //1:guassian to bytes 49 | //AudioFormat af=adataFrame.getFormat(); 50 | byte[]audioBytes=new byte[guassian2.length*2]; 51 | if (af.getSampleSizeInBits() == 16) { 52 | audioBytes=new byte[guassian2.length*2]; 53 | if (af.isBigEndian()) { 54 | for (int i = 0; i < guassian2.length; i++) { 55 | // 56 | audioBytes[2*i]=(byte)((int)guassian2[i]>>8); 57 | audioBytes[2*i+1]= (byte)((int)guassian2[i]); 58 | // 59 | } 60 | } else { 61 | for (int i = 0; i < guassian2.length; i++) { 62 | //System.out.println(i+"*"+guassian2.length); 63 | audioBytes[2*i]=(byte)((int)guassian2[i]); 64 | audioBytes[2*i+1]= (byte)((int)guassian2[i]>>8); 65 | } 66 | } 67 | } else if (af.getSampleSizeInBits() == 8) { 68 | audioBytes=new byte[guassian2.length]; 69 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 70 | for (int i = 0; i < guassian2.length; i++) { 71 | audioBytes[i]=(byte) guassian2[i]; 72 | } 73 | } else { 74 | for (int i = 0; i < guassian2.length; i++) { 75 | audioBytes[i]=(byte) ((byte) guassian2[i]+128); 76 | } 77 | } 78 | } 79 | //2:bytes to adataFrame 80 | System.out.println("now length-->"+audioBytes.length); 81 | ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); 82 | ais = new AudioInputStream(bais, af, audioBytes.length / af.getFrameSize()); 83 | return ais; 84 | } 85 | 86 | public AudioInputStream getAIS(double[] guassian2,AudioInputStream ais) { 87 | // TODO Auto-generated method stub 88 | //1:guassian to bytes 89 | AudioInputStream ais1; 90 | AudioFormat af=ais.getFormat(); 91 | byte[]audioBytes=new byte[guassian2.length*2]; 92 | if (af.getSampleSizeInBits() == 16) { 93 | audioBytes=new byte[guassian2.length*2]; 94 | if (af.isBigEndian()) { 95 | for (int i = 0; i < guassian2.length; i++) { 96 | // 97 | audioBytes[2*i]=(byte)((int)guassian2[i]>>8); 98 | audioBytes[2*i+1]= (byte)((int)guassian2[i]); 99 | // 100 | } 101 | } else { 102 | for (int i = 0; i < guassian2.length; i++) { 103 | //System.out.println(i+"*"+guassian2.length); 104 | audioBytes[2*i]=(byte)((int)guassian2[i]); 105 | audioBytes[2*i+1]= (byte)((int)guassian2[i]>>8); 106 | } 107 | } 108 | } else if (af.getSampleSizeInBits() == 8) { 109 | audioBytes=new byte[guassian2.length]; 110 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 111 | for (int i = 0; i < guassian2.length; i++) { 112 | audioBytes[i]=(byte) guassian2[i]; 113 | } 114 | } else { 115 | for (int i = 0; i < guassian2.length; i++) { 116 | audioBytes[i]=(byte) ((byte) guassian2[i]+128); 117 | } 118 | } 119 | } 120 | //2:bytes to adataFrame 121 | System.out.println("now length-->"+audioBytes.length); 122 | ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); 123 | ais1 = new AudioInputStream(bais, ais.getFormat(), audioBytes.length / af.getFrameSize()); 124 | return ais1; 125 | } 126 | 127 | public AudioInputStream getAIS(byte[] audioBytes, AudioFormat af, 128 | AudioInputStream audioIS) { 129 | ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); 130 | audioIS = new AudioInputStream(bais, af, audioBytes.length / af.getFrameSize()); 131 | return audioIS; 132 | } 133 | } -------------------------------------------------------------------------------- /DP/soundProcessor/Convolution.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import javax.sound.sampled.AudioFormat; 3 | public class Convolution{ 4 | public Convolution(){ 5 | } 6 | public double medGet(int[] audioData, AudioFormat af, int w, int h, int frames_per_pixel){ 7 | int numChannels = af.getChannels(); 8 | int idx=0; 9 | byte my_byte; 10 | double count=0; 11 | for (double x = 0; x < w && audioData != null; x++) { 12 | idx = (int) (frames_per_pixel * numChannels * x); 13 | if (af.getSampleSizeInBits() == 8) { 14 | my_byte = (byte) audioData[idx]; 15 | } else { 16 | my_byte = (byte) (128 * audioData[idx] / 32768 ); 17 | } 18 | double y_new = (double) (h * (128 - my_byte) / 256); 19 | count+=y_new; 20 | } 21 | count=count/w; 22 | if(count>((double)(int)count+0.5)){ 23 | count=(int)count+1; 24 | } 25 | System.out.println(count); 26 | return count; 27 | } 28 | } -------------------------------------------------------------------------------- /DP/soundProcessor/Guassian2dPro.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import java.awt.Dimension; 3 | import java.awt.geom.Line2D; 4 | import java.awt.geom.Line2D.Double; 5 | import java.util.Vector; 6 | 7 | import javax.sound.sampled.AudioFormat; 8 | import javax.sound.sampled.AudioInputStream; 9 | 10 | import movieProcessor.LYGFileIO; 11 | public class Guassian2dPro{ 12 | Vector lines= new Vector(); 13 | byte[] audioBytes; 14 | public double[] guassian; 15 | AudioFormat af; 16 | AudioInputStream ais; 17 | @SuppressWarnings("rawtypes") 18 | public Vector getVectorLines(AudioInputStream ais1){ 19 | ais=ais1; 20 | lines.removeAllElements(); // clear the old vector 21 | af = ais.getFormat(); 22 | audioBytes=null; 23 | if (audioBytes == null) { 24 | try { 25 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 26 | System.out.println("audiobyte length:"+audioBytes.length); 27 | ais.read(audioBytes); 28 | } catch (Exception ex) { 29 | //reportStatus(ex.toString()); 30 | return null; 31 | } 32 | } 33 | Dimension d = new Dimension(800, 600); 34 | int w= d.width; 35 | int h= d.height- 15; 36 | int[] audioData= null; 37 | if (af.getSampleSizeInBits()== 16) { 38 | int nlengthInSamples= audioBytes.length / 2; 39 | audioData = new int[nlengthInSamples]; 40 | if (af.isBigEndian()) { 41 | for (int i= 0; i< nlengthInSamples; i++) { 42 | /* First byte is MSB (high order) */ 43 | int MSB= (int) audioBytes[2*i]; 44 | /* Second byte is LSB (low order) */ 45 | int LSB= (int) audioBytes[2*i+1]; 46 | audioData[i]= MSB<< 8 | (255& LSB); 47 | } 48 | } else { 49 | for (int i= 0; i< nlengthInSamples; i++) { 50 | /* First byte is LSB (low order) */ 51 | int LSB= (int) audioBytes[2*i]; 52 | /* Second byte is MSB (high order) */ 53 | int MSB= (int) audioBytes[2*i+1]; 54 | audioData[i]= MSB<< 8| (255& LSB); 55 | } 56 | } 57 | } else if (af.getSampleSizeInBits()== 8) { 58 | int nlengthInSamples= audioBytes.length; 59 | audioData= new int[nlengthInSamples]; 60 | if(af.getEncoding().toString().startsWith("PCM_SIGN")) { 61 | for (int i = 0; i < audioBytes.length; i++) { 62 | audioData[i] = audioBytes[i]; 63 | } 64 | } else { 65 | for (int i = 0; i < audioBytes.length; i++) { 66 | audioData[i] = audioBytes[i] - 128; 67 | } 68 | } 69 | } 70 | System.out.println(audioBytes.length); 71 | System.out.println(af.getFrameSize()); 72 | double []gua=new double[5]; 73 | double sig=1.6; 74 | double t = 0; 75 | double sumhere = 0; 76 | for(int l = 0; l<5; ++l){ 77 | t = (Math.pow(l-(5/2), 2))/(Math.pow(sig, 2)); 78 | t = Math.exp(-t); 79 | t = (1*t)/(2*Math.PI*Math.pow(sig, 2)); 80 | gua[l] = t; 81 | sumhere = sumhere + gua[l]; 82 | } 83 | 84 | System.out.println("--->"+sumhere); 85 | //--normalization 86 | double sum1=0; 87 | for(int j=0; j<5; ++j) { 88 | gua[j] = gua[j]/sumhere; 89 | sum1 = sum1 + gua[j]; 90 | } 91 | 92 | //--end of producing gaussian matrix 93 | System.out.println("gaussian sum: " + sum1); 94 | guassian=new double[audioData.length]; 95 | double sum=0; 96 | for(int i=2;i lines= new Vector(); 10 | byte[] audioBytes; 11 | //public double []guassian; 12 | AudioFormat af; 13 | AudioInputStream ais; 14 | public double[] audioData = null; 15 | @SuppressWarnings("rawtypes") 16 | public Vector getVectorLines(AudioInputStream ais1){ 17 | ais=ais1; 18 | lines.removeAllElements(); // clear the old vector 19 | af = ais.getFormat(); 20 | audioBytes=null; 21 | if (audioBytes == null) { 22 | try { 23 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 24 | System.out.println("audiobyte length:"+audioBytes.length); 25 | ais.read(audioBytes); 26 | } catch (Exception ex) { 27 | //reportStatus(ex.toString()); 28 | return null; 29 | } 30 | } 31 | Dimension d = new Dimension(800,600); 32 | int w = d.width; 33 | int h = d.height-15; 34 | if (af.getSampleSizeInBits() == 16) { 35 | int nlengthInSamples = audioBytes.length / 2; 36 | audioData = new double[nlengthInSamples]; 37 | if (af.isBigEndian()) { 38 | for (int i = 0; i < nlengthInSamples; i++) { 39 | /* First byte is MSB (high order) */ 40 | int MSB = (int) audioBytes[2*i]; 41 | /* Second byte is LSB (low order) */ 42 | int LSB = (int) audioBytes[2*i+1]; 43 | audioData[i] = MSB << 8 | (255 & LSB); 44 | } 45 | } else { 46 | for (int i = 0; i < nlengthInSamples; i++) { 47 | /* First byte is LSB (low order) */ 48 | int LSB = (int) audioBytes[2*i]; 49 | /* Second byte is MSB (high order) */ 50 | int MSB = (int) audioBytes[2*i+1]; 51 | audioData[i] = MSB << 8 | (255 & LSB); 52 | } 53 | } 54 | } else if (af.getSampleSizeInBits() == 8) { 55 | int nlengthInSamples = audioBytes.length; 56 | audioData = new double[nlengthInSamples]; 57 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 58 | for (int i = 0; i < audioBytes.length; i++) { 59 | audioData[i] = audioBytes[i]; 60 | } 61 | } else { 62 | for (int i = 0; i < audioBytes.length; i++) { 63 | audioData[i] = audioBytes[i] - 128; 64 | } 65 | } 66 | } 67 | System.out.println(audioBytes.length); 68 | System.out.println(af.getFrameSize()); 69 | int psita=0; 70 | for(int i=0;i lines= new Vector(); 10 | byte[] audioBytes; 11 | //public double []guassian; 12 | AudioFormat af; 13 | AudioInputStream ais; 14 | public double[] audioData = null; 15 | public double []laplacian; 16 | @SuppressWarnings("rawtypes") 17 | public Vector getVectorLines(AudioInputStream ais1){ 18 | ais=ais1; 19 | lines.removeAllElements(); // clear the old vector 20 | af = ais.getFormat(); 21 | audioBytes=null; 22 | if (audioBytes == null) { 23 | try { 24 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 25 | System.out.println("audiobyte length:"+audioBytes.length); 26 | ais.read(audioBytes); 27 | } catch (Exception ex) { 28 | //reportStatus(ex.toString()); 29 | return null; 30 | } 31 | } 32 | Dimension d = new Dimension(800,600); 33 | int w = d.width; 34 | int h = d.height-15; 35 | if (af.getSampleSizeInBits() == 16) { 36 | int nlengthInSamples = audioBytes.length / 2; 37 | audioData = new double[nlengthInSamples]; 38 | if (af.isBigEndian()) { 39 | for (int i = 0; i < nlengthInSamples; i++) { 40 | /* First byte is MSB (high order) */ 41 | int MSB = (int) audioBytes[2*i]; 42 | /* Second byte is LSB (low order) */ 43 | int LSB = (int) audioBytes[2*i+1]; 44 | audioData[i] = MSB << 8 | (255 & LSB); 45 | } 46 | } else { 47 | for (int i = 0; i < nlengthInSamples; i++) { 48 | /* First byte is LSB (low order) */ 49 | int LSB = (int) audioBytes[2*i]; 50 | /* Second byte is MSB (high order) */ 51 | int MSB = (int) audioBytes[2*i+1]; 52 | audioData[i] = MSB << 8 | (255 & LSB); 53 | } 54 | } 55 | } else if (af.getSampleSizeInBits() == 8) { 56 | int nlengthInSamples = audioBytes.length; 57 | audioData = new double[nlengthInSamples]; 58 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 59 | for (int i = 0; i < audioBytes.length; i++) { 60 | audioData[i] = audioBytes[i]; 61 | } 62 | } else { 63 | for (int i = 0; i < audioBytes.length; i++) { 64 | audioData[i] = audioBytes[i] - 128; 65 | } 66 | } 67 | } 68 | System.out.println(audioBytes.length); 69 | System.out.println(af.getFrameSize()); 70 | int []lap=new int[5]; 71 | lap[0]=0; 72 | lap[1]=1; 73 | lap[2]=-4; 74 | lap[3]=1; 75 | lap[4]=0; 76 | laplacian=new double[audioData.length]; 77 | double sum=0; 78 | for(int i=2;i lines = new Vector(); 11 | byte[] audioBytes; 12 | public double []guassian; 13 | AudioFormat af; 14 | AudioInputStream ais; 15 | public double[] audioData; 16 | @SuppressWarnings("rawtypes") 17 | public Vector getVectorLines(AudioInputStream ais1){ 18 | ais=ais1; 19 | lines.removeAllElements(); // clear the old vector 20 | af = ais.getFormat(); 21 | audioBytes=null; 22 | if (audioBytes == null) { 23 | try { 24 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 25 | System.out.println("audiobyte length:"+audioBytes.length); 26 | ais.read(audioBytes); 27 | } catch (Exception ex) { 28 | //reportStatus(ex.toString()); 29 | return null; 30 | } 31 | } 32 | Dimension d = new Dimension(800,600); 33 | int w = d.width; 34 | int h = d.height-15; 35 | if (af.getSampleSizeInBits() == 16) { 36 | int nlengthInSamples = audioBytes.length / 2; 37 | audioData = new double[nlengthInSamples]; 38 | if (af.isBigEndian()) { 39 | for (int i = 0; i < nlengthInSamples; i++) { 40 | /* First byte is MSB (high order) */ 41 | int MSB = (int) audioBytes[2*i]; 42 | /* Second byte is LSB (low order) */ 43 | int LSB = (int) audioBytes[2*i+1]; 44 | audioData[i] = MSB << 8 | (255 & LSB); 45 | } 46 | } else { 47 | for (int i = 0; i < nlengthInSamples; i++) { 48 | /* First byte is LSB (low order) */ 49 | int LSB = (int) audioBytes[2*i]; 50 | /* Second byte is MSB (high order) */ 51 | int MSB = (int) audioBytes[2*i+1]; 52 | audioData[i] = MSB << 8 | (255 & LSB); 53 | } 54 | } 55 | } else if (af.getSampleSizeInBits()== 8) { 56 | int nlengthInSamples= audioBytes.length; 57 | audioData= new double[nlengthInSamples]; 58 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 59 | for (int i= 0; i< audioBytes.length; i++) { 60 | audioData[i]= audioBytes[i]; 61 | } 62 | } else { 63 | for (int i= 0; i< audioBytes.length; i++) { 64 | audioData[i]= audioBytes[i]- 128; 65 | } 66 | } 67 | } 68 | System.out.println(audioBytes.length); 69 | System.out.println(af.getFrameSize()); 70 | int count= 0; 71 | int comp= 2000; 72 | int find= 0; 73 | int max= 1; 74 | for(int i= 0;i< audioData.length; i++) { 75 | if(audioData[i]< 0&& audioData[i+ 1]> 0){ 76 | if(find== 0) { 77 | find= 0; 78 | for(int j= 0; j comp|| audioData[i]< -comp) { 93 | find= 1; 94 | } 95 | } 96 | count=0; 97 | for(int i= 0; i< audioData.length; i++) { 98 | if(audioData[i]< 0&& audioData[i+ 1]> 0) { 99 | System.out.println("cur count"+ count); 100 | if(count< 5|| count> 200) { 101 | for(int j= 0; j lines= new Vector(); 12 | byte[] audioBytes; 13 | //public double []guassian; 14 | AudioFormat af; 15 | AudioInputStream ais; 16 | public double[] audioData = null; 17 | public double[] getVectorLines(AudioInputStream ais1) throws IOException{ 18 | ais=ais1; 19 | lines.removeAllElements(); // clear the old vector 20 | af = ais.getFormat(); 21 | audioBytes=null; 22 | if (audioBytes == null) { 23 | try { 24 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 25 | System.out.println("audiobyte length:"+audioBytes.length); 26 | ais.read(audioBytes); 27 | } catch (Exception ex) { 28 | //reportStatus(ex.toString()); 29 | return null; 30 | } 31 | } 32 | ais.reset(); 33 | Dimension d = new Dimension(800,600); 34 | int w = d.width; 35 | int h = d.height-15; 36 | if (af.getSampleSizeInBits() == 16) { 37 | int nlengthInSamples = audioBytes.length / 2; 38 | audioData = new double[nlengthInSamples]; 39 | if (af.isBigEndian()) { 40 | for (int i = 0; i < nlengthInSamples; i++) { 41 | /* First byte is MSB (high order) */ 42 | int MSB = (int) audioBytes[2*i]; 43 | /* Second byte is LSB (low order) */ 44 | int LSB = (int) audioBytes[2*i+1]; 45 | audioData[i] = MSB << 8 | (255 & LSB); 46 | } 47 | } else { 48 | for (int i = 0; i < nlengthInSamples; i++) { 49 | /* First byte is LSB (low order) */ 50 | int LSB = (int) audioBytes[2*i]; 51 | /* Second byte is MSB (high order) */ 52 | int MSB = (int) audioBytes[2*i+1]; 53 | audioData[i] = MSB << 8 | (255 & LSB); 54 | } 55 | } 56 | } else if (af.getSampleSizeInBits() == 8) { 57 | int nlengthInSamples = audioBytes.length; 58 | audioData = new double[nlengthInSamples]; 59 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 60 | for (int i = 0; i < audioBytes.length; i++) { 61 | audioData[i] = audioBytes[i]; 62 | } 63 | } else { 64 | for (int i = 0; i < audioBytes.length; i++) { 65 | audioData[i] = audioBytes[i] - 128; 66 | } 67 | } 68 | } 69 | System.out.println(audioBytes.length); 70 | System.out.println(af.getFrameSize()); 71 | int psita=0; 72 | for(int i=16;i>8); 16 | audioBytes[2*i+1]= (byte)((int)guassian2[i]); 17 | // 18 | } 19 | } else { 20 | for (int i = 0; i < guassian2.length; i++) { 21 | //System.out.println(i+"*"+guassian2.length); 22 | audioBytes[2*i]=(byte)((int)guassian2[i]); 23 | audioBytes[2*i+1]= (byte)((int)guassian2[i]>>8); 24 | } 25 | } 26 | } else if (af.getSampleSizeInBits() == 8) { 27 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 28 | for (int i = 0; i < guassian2.length; i++) { 29 | audioBytes[i]=(byte) guassian2[i]; 30 | } 31 | } else { 32 | for (int i = 0; i < audioBytes.length; i++) { 33 | audioBytes[i]=(byte) ((byte) guassian2[i]+128); 34 | } 35 | } 36 | } 37 | //2:bytes to adataFrame 38 | System.out.println("now length-->"+audioBytes.length); 39 | ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); 40 | ais = new AudioInputStream(bais, ais.getFormat(), audioBytes.length / af.getFrameSize()); 41 | return ais; 42 | } 43 | } -------------------------------------------------------------------------------- /DP/soundProcessor/SoundLinesVector.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import java.awt.Dimension; 3 | import java.awt.geom.Line2D; 4 | import java.awt.geom.Line2D.Double; 5 | import java.util.Vector; 6 | 7 | import javax.sound.sampled.AudioFormat; 8 | import javax.sound.sampled.AudioInputStream; 9 | public class SoundLinesVector{ 10 | Vector lines= new Vector(); 11 | byte[] audioBytes; 12 | @SuppressWarnings("rawtypes") 13 | public Vector getVectorLines(AudioInputStream ais){ 14 | lines.removeAllElements(); // clear the old vector 15 | AudioFormat af = ais.getFormat(); 16 | audioBytes=null; 17 | if (audioBytes == null) { 18 | try { 19 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 20 | System.out.println("audiobyte length:"+audioBytes.length); 21 | ais.read(audioBytes); 22 | } catch (Exception ex) { 23 | //reportStatus(ex.toString()); 24 | return null; 25 | } 26 | } 27 | Dimension d = new Dimension(800,600); 28 | int w = d.width; 29 | int h = d.height-15; 30 | int[] audioData = null; 31 | if (af.getSampleSizeInBits() == 16) { 32 | int nlengthInSamples = audioBytes.length / 2; 33 | audioData = new int[nlengthInSamples]; 34 | if (af.isBigEndian()) { 35 | for (int i = 0; i < nlengthInSamples; i++) { 36 | /* First byte is MSB (high order) */ 37 | int MSB = (int) audioBytes[2*i]; 38 | /* Second byte is LSB (low order) */ 39 | int LSB = (int) audioBytes[2*i+1]; 40 | audioData[i] = MSB << 8 | (255 & LSB); 41 | } 42 | } else { 43 | for (int i = 0; i < nlengthInSamples; i++) { 44 | /* First byte is LSB (low order) */ 45 | int LSB = (int) audioBytes[2*i]; 46 | /* Second byte is MSB (high order) */ 47 | int MSB = (int) audioBytes[2*i+1]; 48 | audioData[i] = MSB << 8 | (255 & LSB); 49 | } 50 | } 51 | } else if (af.getSampleSizeInBits() == 8) { 52 | int nlengthInSamples = audioBytes.length; 53 | audioData = new int[nlengthInSamples]; 54 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 55 | for (int i = 0; i < audioBytes.length; i++) { 56 | audioData[i] = audioBytes[i]; 57 | } 58 | } else { 59 | for (int i = 0; i < audioBytes.length; i++) { 60 | audioData[i] = audioBytes[i] - 128; 61 | } 62 | } 63 | } 64 | System.out.println(audioBytes.length); 65 | System.out.println(af.getFrameSize()); 66 | System.out.println(w); 67 | System.out.println(audioData.length); 68 | int frames_per_pixel = audioBytes.length / af.getFrameSize()/w; 69 | byte my_byte = 0; 70 | int idx=0; 71 | double y_last = 0; 72 | int numChannels = af.getChannels(); 73 | for (double x = 0; x < w && audioData != null; x+=3) { 74 | idx = (int) (frames_per_pixel * numChannels * x); 75 | if (af.getSampleSizeInBits() == 8) { 76 | my_byte = (byte) audioData[idx]; 77 | } else { 78 | my_byte = (byte)(128 * audioData[idx]/32768); 79 | } 80 | double y_new = (double)(h*(128-my_byte)/256); 81 | lines.add(new Line2D.Double(x, y_last, x,y_new)); 82 | lines.add(new Line2D.Double(x, y_new, x+3,y_new)); 83 | y_last = y_new; 84 | } 85 | return lines; 86 | } 87 | } -------------------------------------------------------------------------------- /DP/soundProcessor/SoundMedVector.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import java.awt.Dimension; 3 | import java.awt.geom.Line2D; 4 | import java.awt.geom.Line2D.Double; 5 | import java.util.Vector; 6 | 7 | import javax.sound.sampled.AudioFormat; 8 | import javax.sound.sampled.AudioInputStream; 9 | public class SoundMedVector{ 10 | Vector lines= new Vector(); 11 | byte[] audioBytes; 12 | @SuppressWarnings("rawtypes") 13 | public Vector getVectorLines(AudioInputStream ais){ 14 | lines.removeAllElements(); // clear the old vector 15 | AudioFormat af = ais.getFormat(); 16 | audioBytes=null; 17 | if(audioBytes==null) { 18 | try { 19 | audioBytes = new byte[(int)(ais.getFrameLength()*af.getFrameSize())]; 20 | System.out.println("audiobyte length:"+audioBytes.length); 21 | ais.read(audioBytes); 22 | } catch (Exception ex) { 23 | //reportStatus(ex.toString()); 24 | return null; 25 | } 26 | } 27 | Dimension d = new Dimension(800,600); 28 | int w = d.width; 29 | int h = d.height-15; 30 | int[] audioData = null; 31 | if (af.getSampleSizeInBits() == 16) { 32 | int nlengthInSamples = audioBytes.length / 2; 33 | audioData = new int[nlengthInSamples]; 34 | if (af.isBigEndian()) { 35 | for (int i = 0; i < nlengthInSamples; i++) { 36 | /* First byte is MSB (high order) */ 37 | int MSB = (int) audioBytes[2*i]; 38 | /* Second byte is LSB (low order) */ 39 | int LSB = (int) audioBytes[2*i+1]; 40 | audioData[i] = MSB << 8 | (255 & LSB); 41 | } 42 | } else { 43 | for (int i = 0; i < nlengthInSamples; i++) { 44 | /* First byte is LSB (low order) */ 45 | int LSB = (int) audioBytes[2*i]; 46 | /* Second byte is MSB (high order) */ 47 | int MSB = (int) audioBytes[2*i+1]; 48 | audioData[i] = MSB << 8 | (255 & LSB); 49 | } 50 | } 51 | } else if (af.getSampleSizeInBits() == 8) { 52 | int nlengthInSamples = audioBytes.length; 53 | audioData = new int[nlengthInSamples]; 54 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 55 | for (int i = 0; i < audioBytes.length; i++) { 56 | audioData[i] = audioBytes[i]; 57 | } 58 | } else { 59 | for (int i = 0; i < audioBytes.length; i++) { 60 | audioData[i] = audioBytes[i] - 128; 61 | } 62 | } 63 | } 64 | System.out.println(audioBytes.length); 65 | System.out.println(af.getFrameSize()); 66 | System.out.println(w); 67 | System.out.println(audioData.length); 68 | int frames_per_pixel = audioBytes.length / af.getFrameSize()/w; 69 | byte my_byte = 0; 70 | int idx=0; 71 | int numChannels = af.getChannels(); 72 | double med= new Convolution().medGet(audioData,af,w,h,frames_per_pixel); 73 | for (double x = 0; x < w && audioData != null; x+=3) { 74 | idx = (int) (frames_per_pixel * numChannels * x); 75 | if (af.getSampleSizeInBits() == 8) { 76 | my_byte = (byte) audioData[idx]; 77 | } else { 78 | my_byte = (byte)(128 * audioData[idx]/32768); 79 | } 80 | double y_new = (double)(h*(128-my_byte)/256); 81 | lines.add(new Line2D.Double(x, med,x,y_new)); 82 | } 83 | return lines; 84 | } 85 | } -------------------------------------------------------------------------------- /DP/soundProcessor/SoundRecord.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import java.io.ByteArrayInputStream; 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.IOException; 5 | 6 | import javax.sound.sampled.AudioFormat; 7 | import javax.sound.sampled.AudioInputStream; 8 | import javax.sound.sampled.AudioSystem; 9 | import javax.sound.sampled.DataLine; 10 | import javax.sound.sampled.LineUnavailableException; 11 | import javax.sound.sampled.TargetDataLine; 12 | public class SoundRecord implements Runnable { 13 | public AudioInputStream ais1; 14 | public int big; 15 | TargetDataLine line; 16 | Thread thread; 17 | AudioFormat format; 18 | public boolean stoped=false; 19 | @SuppressWarnings("unused") 20 | public SoundRecord(AudioInputStream ais2){ 21 | ais1 = null; 22 | 23 | AudioFormat.Encoding encoding = AudioFormat.Encoding.PCM_SIGNED; 24 | float rate = 9600f; 25 | int sampleSize = 16; 26 | String signedString = "signed"; 27 | boolean bigEndian = true; 28 | int channels = 2; 29 | format = new AudioFormat(encoding, rate, sampleSize, 30 | channels, (sampleSize / 8) * channels, rate, bigEndian); 31 | //ais1=ais2; 32 | } 33 | 34 | public void run(){ 35 | DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); 36 | if (!AudioSystem.isLineSupported(info)) { 37 | return; 38 | } 39 | // get and open the target data line for capture. 40 | try { 41 | line = (TargetDataLine) AudioSystem.getLine(info); 42 | line.open(format, line.getBufferSize()); 43 | } catch (LineUnavailableException ex) { 44 | return; 45 | } catch (SecurityException ex) { 46 | //shutDown(ex.toString()); 47 | return; 48 | } catch (Exception ex) { 49 | //shutDown(ex.toString()); 50 | return; 51 | } 52 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 53 | int frameSizeInBytes = format.getFrameSize(); 54 | int bufferLengthInFrames = line.getBufferSize() / 8; 55 | int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes; 56 | System.out.println("bufferLengthInBytes : " + bufferLengthInBytes +" **"); 57 | byte[] data = new byte[bufferLengthInBytes]; 58 | int numBytesRead = 0; 59 | line.start(); 60 | //System.out.println(line); 61 | while (thread != null) { 62 | if((numBytesRead = line.read(data, 0, bufferLengthInBytes)) == -1) { 63 | break; 64 | } 65 | out.write(data, 0, numBytesRead); 66 | } 67 | // line.drain(); 68 | // we reached the end of the stream. stop and close the line. 69 | line.stop(); 70 | line.close(); 71 | line = null; 72 | // stop and close the output stream 73 | try { 74 | out.flush(); 75 | out.close(); 76 | } catch (IOException ex) { 77 | ex.printStackTrace(); 78 | } 79 | // load bytes into the audio input stream for playback 80 | byte[] audioBytes = out.toByteArray(); 81 | ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); 82 | ais1 = new AudioInputStream(bais, format, audioBytes.length / format.getFrameSize()); 83 | stoped=true; 84 | } 85 | 86 | public void start() { 87 | // TODO Auto-generated method stub 88 | stoped=false; 89 | thread = new Thread(this); 90 | thread.setName("Capture"); 91 | thread.run(); 92 | } 93 | 94 | public void stop() { 95 | thread = null; 96 | } 97 | } -------------------------------------------------------------------------------- /DP/soundProcessor/SoundRegressionVector.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import java.awt.Dimension; 3 | import java.awt.geom.Line2D; 4 | import java.awt.geom.Line2D.Double; 5 | import java.util.Vector; 6 | 7 | import javax.sound.sampled.AudioFormat; 8 | import javax.sound.sampled.AudioInputStream; 9 | public class SoundRegressionVector{ 10 | Vector lines= new Vector(); 11 | byte[] audioBytes; 12 | @SuppressWarnings("rawtypes") 13 | public Vector getVectorLines(AudioInputStream ais){ 14 | lines.removeAllElements(); // clear the old vector 15 | AudioFormat af = ais.getFormat(); 16 | audioBytes=null; 17 | if (audioBytes == null) { 18 | try { 19 | audioBytes = new byte[(int) (ais.getFrameLength() *af.getFrameSize())]; 20 | System.out.println("audiobyte length:"+audioBytes.length); 21 | ais.read(audioBytes); 22 | } catch (Exception ex) { 23 | //reportStatus(ex.toString()); 24 | return null; 25 | } 26 | } 27 | Dimension d = new Dimension(800,600); 28 | int w = d.width; 29 | int h = d.height-15; 30 | int[] audioData = null; 31 | if (af.getSampleSizeInBits() == 16) { 32 | int nlengthInSamples = audioBytes.length / 2; 33 | audioData = new int[nlengthInSamples]; 34 | if (af.isBigEndian()) { 35 | for (int i = 0; i < nlengthInSamples; i++) { 36 | /* First byte is MSB (high order) */ 37 | int MSB = (int) audioBytes[2*i]; 38 | /* Second byte is LSB (low order) */ 39 | int LSB = (int) audioBytes[2*i+1]; 40 | audioData[i] = MSB << 8 | (255 & LSB); 41 | } 42 | } else { 43 | for (int i = 0; i < nlengthInSamples; i++) { 44 | /* First byte is LSB (low order) */ 45 | int LSB = (int) audioBytes[2*i]; 46 | /* Second byte is MSB (high order) */ 47 | int MSB = (int) audioBytes[2*i+1]; 48 | audioData[i] = MSB << 8 | (255 & LSB); 49 | } 50 | } 51 | } else if (af.getSampleSizeInBits() == 8) { 52 | int nlengthInSamples = audioBytes.length; 53 | audioData = new int[nlengthInSamples]; 54 | if (af.getEncoding().toString().startsWith("PCM_SIGN")) { 55 | for (int i = 0; i < audioBytes.length; i++) { 56 | audioData[i] = audioBytes[i]; 57 | } 58 | } else { 59 | for (int i = 0; i < audioBytes.length; i++) { 60 | audioData[i] = audioBytes[i] - 128; 61 | } 62 | } 63 | } 64 | int frames_per_pixel = audioBytes.length / af.getFrameSize()/w; 65 | byte my_byte = 0; 66 | int idx=0; 67 | int numChannels = af.getChannels(); 68 | double med= new Convolution().medGet(audioData,af,w,h,frames_per_pixel); 69 | for (double x = 0; x < w && audioData != null; x+=3) { 70 | idx = (int) (frames_per_pixel * numChannels * x); 71 | if (af.getSampleSizeInBits() == 8) { 72 | my_byte = (byte) audioData[idx]; 73 | } else { 74 | my_byte = (byte)(128 * audioData[idx]/32768); 75 | } 76 | double y_new = (double)(h*(128-my_byte)/256); 77 | lines.add(new Line2D.Double(x, med, x,y_new)); 78 | } 79 | return lines; 80 | } 81 | } -------------------------------------------------------------------------------- /DP/soundProcessor/SoundWaveVector.java: -------------------------------------------------------------------------------- 1 | package soundProcessor; 2 | import java.awt.Dimension; 3 | 4 | import java.awt.geom.Line2D; 5 | import java.awt.geom.Line2D.Double; 6 | import java.util.Vector; 7 | 8 | import javax.sound.sampled.AudioFormat; 9 | import javax.sound.sampled.AudioInputStream; 10 | 11 | 12 | 13 | 14 | import movieProcessor.LYGFileIO; 15 | public class SoundWaveVector{ 16 | Vector lines= new Vector(); 17 | public byte[] audioBytes; 18 | public double[] audioData = null; 19 | public double pshock; 20 | public double nshock; 21 | @SuppressWarnings("rawtypes") 22 | public Vector getVectorLines(AudioInputStream ais, float sFrameRate){ 23 | lines.removeAllElements(); // clear the old vector 24 | AudioFormat af = ais.getFormat(); 25 | audioBytes=null; 26 | if (audioBytes == null) { 27 | try { 28 | int reg=0; 29 | audioBytes = new byte[(int) (sFrameRate * af.getFrameSize())]; 30 | System.out.println("audiobyte length:"+audioBytes.length); 31 | reg= ais.read(audioBytes); 32 | if(reg < audioBytes.length);{ 33 | byte[] iner=new byte[reg]; 34 | for(int i=0;i-5) 188 | newdata1[i]=0; 189 | newdata1[i]*=2; 190 | } 191 | System.out.println("good2"); 192 | //xianfu 193 | for(double x = 0; x < w; x++) { 194 | //System.out.println("->"+audioData[idx]); 195 | double y_new = newdata1[(int)x]; 196 | lines.add(new Line2D.Double(x, y_last, x, y_new)); 197 | y_last = y_new; 198 | if(y_new>pshock) 199 | pshock= y_new; 200 | if(y_new"+audioData[idx]); 280 | double y_new = (double)(h*(128-my_byte)/256); 281 | lines.add(new Line2D.Double(x, y_last, x, y_new)); 282 | y_last = y_new; 283 | if(y_new>pshock) 284 | pshock= y_new; 285 | if(y_new 20|| k< 50)) { 11 | t++; 12 | } 13 | } 14 | } 15 | } 16 | timeCheck.end(); 17 | timeCheck.duration(); 18 | System.out.println(t); 19 | } 20 | } -------------------------------------------------------------------------------- /DP/timeProcessor/TimeCheck.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/DP/timeProcessor/TimeCheck.java -------------------------------------------------------------------------------- /DP/waveProcessor/Common.java: -------------------------------------------------------------------------------- 1 | package waveProcessor; 2 | 3 | 4 | public class Common{ 5 | public double[] zhiShu(double[] input, double scale,double shehold) { 6 | double [] output= new double [input.length]; 7 | for(int i= 0; i> 1]; 23 | for (int k= 0; k< N>> 1; k++) { 24 | even[k]= x[2* k]; 25 | } 26 | 27 | cp[] q= fftk(even); 28 | cp[] odd= even; 29 | for (int k= 0; k< N>> 1; k++) { 30 | odd[k]= x[2* k+ 1]; 31 | } 32 | 33 | cp[] r= fftk(odd); 34 | cp[] y= new cp[N]; 35 | for (int k= 0; k< N; k++) { 36 | y[k]= new cp(); 37 | } 38 | for (int k= 0; k< N>> 1; k++) { 39 | double kth= k* pi/ N; 40 | cp wk= new cp(); 41 | wk.real= Math.cos(kth); 42 | wk.image= Math.sin(kth); 43 | 44 | cp times= new cp(); 45 | times.real= wk.real* r[k].real- wk.image* r[k].image; 46 | times.image= wk.real* r[k].image+ wk.image* r[k].real; 47 | 48 | y[k].real= q[k].real+ times.real; 49 | y[k].image= q[k].image+ times.image; 50 | y[k+ N/ 2].real= q[k].real- times.real; 51 | y[k+ N/ 2].image= q[k].image- times.image; 52 | } 53 | return y; 54 | } 55 | } 56 | 57 | class cp{ 58 | double real; 59 | double image; 60 | double value; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /DP/waveProcessor/Guassian.java: -------------------------------------------------------------------------------- 1 | package waveProcessor; 2 | 3 | public class Guassian{ 4 | public double[] guassian1d(double[] input, double scale ) { 5 | double [] output= new double [input.length]; 6 | double []gua= new double[5]; 7 | double sig= scale; //default 1.6 8 | double t= 0; 9 | double sumHere= 0; 10 | for(int l= 0; l< 5; ++l){ 11 | t= (Math.pow(l- (5/ 2), 2))/ (Math.pow(sig, 2)); 12 | t= Math.exp(-t); 13 | t= (1* t)/ (2* Math.PI* Math.pow(sig, 2)); 14 | gua[l]= t; 15 | sumHere= sumHere+ gua[l]; 16 | } 17 | // System.out.println("--->"+sumHere); 18 | //--normalization 19 | double sum1=0; 20 | for(int j=0; j<5; ++j){ 21 | gua[j]= gua[j]/ sumHere; 22 | sum1= sum1+ gua[j]; 23 | } 24 | //--end of producing gaussian matrix 25 | // System.out.println("gaussian sum: " + sum1); 26 | double sum= 0; 27 | for(int i= 2; i< input.length-2; i++){ 28 | sum= 0; 29 | for(int j= -2; j< 3; j++){ 30 | sum= sum+ (input[i+ j]* gua[j+ 2]); 31 | } 32 | output[i]= sum; 33 | } 34 | return output; 35 | }; 36 | } -------------------------------------------------------------------------------- /DP/waveProcessor/Laplasian.java: -------------------------------------------------------------------------------- 1 | package waveProcessor; 2 | public class Laplasian{ 3 | @SuppressWarnings("unused") 4 | public double[] laplasian1d(double[] input, double scale ) { 5 | double [] output = new double [input.length]; 6 | double []lap=new double[5]; 7 | double sig= scale; //default 1.6 8 | double t= 0; 9 | double sumhere= 0; 10 | lap[0]= 0; 11 | lap[1]= -3; 12 | lap[2]= scale;//default=7 13 | lap[3]= -3; 14 | lap[4]= 0; 15 | for(int l= 0; l< 5; ++l){ 16 | sumhere= sumhere+ lap[l]; 17 | } 18 | // System.out.println("--->"+sumhere); 19 | //--normalization 20 | double sum1= 0; 21 | for(int j= 0; j< 5; ++j){ 22 | lap[j]= lap[j]/ sumhere; 23 | sum1= sum1+ lap[j]; 24 | } 25 | //--end of producing gaussian matrix 26 | // System.out.println("gaussian sum: " + sum1); 27 | double sum= 0; 28 | for(int i= 2; i max) { 7 | max= input[i]; 8 | } 9 | } 10 | return max; 11 | }; 12 | 13 | public double max_i(double[] input) { 14 | double max= 0; 15 | for(int i= 0; i max) { 17 | max= i; 18 | } 19 | } 20 | return max; 21 | }; 22 | 23 | @SuppressWarnings("unused") 24 | public double min_v(double[] input,double rank) { 25 | double min= 999999999; 26 | double[][] fengtong= new waveProcessor.PeakStatistic().fengTong1(input); 27 | for(int i= 0; i output[j][0]) { 53 | double tempc[]= new double [2]; 54 | tempc[0]= output[i][0]; 55 | tempc[1]= output[i][1]; 56 | output[i][0]= output[j][0]; 57 | output[i][1]= output[j][1]; 58 | output[j][0]= tempc[0]; 59 | output[j][1]= tempc[1]; 60 | } 61 | } 62 | } 63 | return output; 64 | } 65 | 66 | public double[][] fengPaiYy(double[][] input) { 67 | double[][] output=new waveProcessor.Copy().copy2d(input,input.length); 68 | for(int i= 0; i< input.length; i++) { 69 | for(int j= 0; j< input.length; j++) { 70 | if(output[i][1]> output[j][1]) { 71 | double tempc[]= new double [2]; 72 | tempc[0]= output[i][0]; 73 | tempc[1]= output[i][1]; 74 | output[i][0]= output[j][0]; 75 | output[i][1]= output[j][1]; 76 | output[j][0]= tempc[0]; 77 | output[j][1]= tempc[1]; 78 | } 79 | } 80 | } 81 | return output; 82 | } 83 | } -------------------------------------------------------------------------------- /DP/waveProcessor/Proportion.java: -------------------------------------------------------------------------------- 1 | package waveProcessor; 2 | public class Proportion{ 3 | public double[] newX(double[] input, double width) {//128 32 4 | double [] output= new double [(int)width]; 5 | double bilix= input.length/ width;//4 6 | for(int i= 0; i< output.length; i++) { 7 | for(int j= 0;j< bilix; j++) { 8 | output[i]+= input[(int)(i*bilix+j)]; 9 | } 10 | } 11 | return output; 12 | }; 13 | 14 | public double[] newY(double[] input, double hight) { 15 | double [] output= new double [input.length]; 16 | double max= new waveProcessor.MaxAndMin().max_v(input); 17 | double biliy= hight/ max; 18 | for(int i=0; i input[i]) { 22 | find+= 1; 23 | } 24 | } 25 | if(find== scale) { 26 | output[0]= input[0]; 27 | } 28 | for(int i= (int)(scale);i< (sum- (scale)); i++) { 29 | find= 0; 30 | for(int j= 1;j<= scale; j++) { 31 | if(input[i]>input[i+ j]) { 32 | find+= 1; 33 | } 34 | if(input[i]> input[i- j]) { 35 | find+= 1; 36 | } 37 | } 38 | if(find==scale* 2) { 39 | output[i]= input[i]; 40 | } 41 | } 42 | return output; 43 | } 44 | 45 | @SuppressWarnings("unused") 46 | public double[] liangHuaDengChaMines(double[] input, int scale) { 47 | double[] output= new double[input.length]; 48 | double sum= input.length/ scale; 49 | for(int i= 0; i< sum- 1; i++) { 50 | double temp= 0; 51 | double max= input[(int)(i* scale)]; 52 | double maxi= i* scale; 53 | for(int j= 0; j< scale; j++) { 54 | if(input[(int)(i* scale+ j)]> max) { 55 | max= input[(int)(i*scale+ j)]; 56 | maxi= (int)(i* scale+ j); 57 | } 58 | } 59 | output[(int)(i* scale)]= max; 60 | } 61 | 62 | return output; 63 | } 64 | 65 | public double[] liangHuaEqualDelete(double[] input) { 66 | double[] output= new double[input.length]; 67 | double pre= 0; 68 | double next= 0; 69 | for(int i= 0; i< input.length; i++) { 70 | next= input[i]; 71 | if(next!= pre) { 72 | output[i]= input[i]; 73 | }else { 74 | output[i]= 0; 75 | } 76 | pre= next; 77 | } 78 | return output; 79 | } 80 | 81 | public double[] liangHuaXiHuaHalfSide(double[] input) { 82 | double[] output= new double[input.length]; 83 | for(int i= 1; i< input.length- 1; i++){ 84 | if(input[i]/ input[i+ 1]<= 1&& input[i]/ input[i+ 1]>= 0.5) { 85 | if(input[i]/ input[i- 1]<= 1&& input[i]/ input[i- 1]>= 0.5) { 86 | output[i]= input[i]; 87 | } 88 | } 89 | } 90 | return output; 91 | } 92 | } -------------------------------------------------------------------------------- /DP/waveProcessor/Shehold.java: -------------------------------------------------------------------------------- 1 | package waveProcessor; 2 | public class Shehold{ 3 | public double[] shehold(double[] input, double scale) { 4 | double[] output= new double[input.length]; 5 | for(int i= 0;i< input.length; i++) { 6 | if(input[i]> scale) { 7 | //output[i]=input[i]; 8 | output[i]= 100; 9 | } 10 | } 11 | return output; 12 | }; 13 | 14 | public double[] shehold(double[] input, double scale, int destination) { 15 | double[] output= new double[input.length]; 16 | for(int i= 0;i< input.length; i++) { 17 | if(input[i]> scale) { 18 | //output[i]=input[i]; 19 | output[i]= destination; 20 | } 21 | } 22 | return output; 23 | }; 24 | } -------------------------------------------------------------------------------- /DP/waveProcessor/Tailor.java: -------------------------------------------------------------------------------- 1 | package waveProcessor; 2 | public class Tailor{ 3 | public double[] caiJian(double[] input, double left, double right) { 4 | double w= (int)(right- left); 5 | double[] output= new double [(int)w]; 6 | for(int i= (int)left; i \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /mu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoguangluo/Data_Processor/622947ac4e3bda42fc274dd69b65450fb3b651d7/mu.png -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | Data_Processor 4 | Data_Processor 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user guide at https://docs.gradle.org/4.10.3/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'Data_Processor' 11 | --------------------------------------------------------------------------------