全國企業資訊中心幾個城市處理結果
阿新 • • 發佈:2018-12-27
通過呼叫相同的方法,來對全國企業資訊中心中的不同種類省份的驗證碼進行識別。/*********** 江蘇省的圖片處理****************/ public static BufferedImage handleForJiangsu(BufferedImage src){ BufferedImage src1 = null; src = ImageUtil.ThresholdFilter(src, 0xbc); src1 = ImageUtil.MedianFilter(src, 4, 3); return src1; } /****************北京市的圖片處理*************************/ public static BufferedImage handleForBeijing(BufferedImage src){ src = ImageUtil.ThresholdFilter(src, 0xaa); int width = src.getWidth(); int height = src.getHeight(); src = src.getSubimage(8, 2, width-8, height-4); width -= 8; height -=4; /*for(int i = 0; i <height; i++) { image.setRGB(0, i, intBack); image.setRGB(width-1, i, intBack); }*/ for(int i = 0; i< width; i++) { src.setRGB(i, 0, intBack); src.setRGB(i, height-1, intBack); } src = ImageUtil.MedianFilter(src, 10, 3); return src; } /*********** 四川省/陝西省的圖片處理****************/ public static BufferedImage handleForSichuan(BufferedImage src){ src = ImageUtil.ThresholdFilter(src, 0x80); //src = ImageUtil.MedianFilter(src, 4, 3); return src; } /*********** 遼寧省的圖片處理****************/ public static BufferedImage handleForLiaoning(BufferedImage src){ src = ImageUtil.ThresholdConventFilter(src, 0x80); //src = ImageUtil.MedianFilter(src, 1, 3); return src; } /***********江西省的圖片處理****************/ public static BufferedImage handleForJiangxi(BufferedImage src){ src = ImageUtil.ThresholdFilter(src, 0x80); //src = ImageUtil.MedianFilter(src, 4, 3); return src; } /***********寧夏省的圖片處理****************/ public static BufferedImage handleForNingxia(BufferedImage src){ src = ImageUtil. ThresholdFilter(src, 0x80); int width = src.getWidth(); int height = src.getHeight(); src = src.getSubimage(4, 2, width-8, height-4); width -= 8; height -=4; for(int i = 0; i <height; i++){ src.setRGB(0, i, intBack); src.setRGB(width-1, i, intBack); } for(int i = 0; i< width; i++){ src.setRGB(i, 0, intBack); src.setRGB(i, height-1, intBack); } src = ImageUtil.MedianFilter(src, 1, 3); return src; } /***********山東省/吉林省的圖片處理****************/ public static BufferedImage handleForShandong(BufferedImage src){ src = ImageUtil. ThresholdFilter(src, 0x80); //src = ImageUtil.MedianFilter(src, 4, 3); return src; } /***********天津市的圖片處理****************/ public static BufferedImage handleForTianjing(BufferedImage src){ src = ImageUtil. ThresholdFilter(src, 0x64); //src = ImageUtil.MedianFilter(src, 4, 3); int width = src.getWidth(); int height = src.getHeight(); src = src.getSubimage(4, 2, width-8, height-4); width -= 8; height -=4; for(int i = 0; i <height; i++){ src.setRGB(0, i, intBack); src.setRGB(width-1, i, intBack); } for(int i = 0; i< width; i++){ src.setRGB(i, 0, intBack); src.setRGB(i, height-1, intBack); } return src; } /********** 重慶市的圖片處理****************/ public static BufferedImage handleForChongqing(BufferedImage src){ src = ImageUtil. ThresholdFilter(src, 0x50); src = ImageUtil.MedianFilter(src, 2, 3); return src; } /********** 湖南省的圖片處理****************/ public static BufferedImage handleForHunan(BufferedImage src){ src = ImageUtil. ThresholdFilter(src, 0xaa); src = ImageUtil.MedianFilter(src, 1, 3); return src; } }