当前位置: 首页 > wzjs >正文

找人做菠菜网站需要多少钱今日的最新新闻

找人做菠菜网站需要多少钱,今日的最新新闻,顾问式 网站,好点的开发网站的公司项目上移植了研发部的产品,文档不全,项目上验证码功能无法关闭,又要做接口/性能测试,开发不配合(作为测试多么无奈),此方法识别命中率不高,仅作借鉴。 版本JDK11 import io.restass…

项目上移植了研发部的产品,文档不全,项目上验证码功能无法关闭,又要做接口/性能测试,开发不配合(作为测试多么无奈),此方法识别命中率不高,仅作借鉴。
版本JDK11

import io.restassured.response.Response;
import net.sourceforge.tess4j.Tesseract;import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;import static io.restassured.RestAssured.given;public class ImageCodeTess {/*** urlInfo基本信息* */public static String getUrl(String prototype,String host,String port,String uri){UrlInfo urlInfo = new UrlInfo();urlInfo.setPrototype(prototype);urlInfo.setHost(host);urlInfo.setPost(port);urlInfo.setUri(uri);return urlInfo.toString();}/*** 获取验证码的响应map* */public static Map<String,String> getImageBase64Map(String url){Map<String,String> map = new HashMap<>();Response response = given().when().get(url).then().extract().response();map.put("imageContent",response.jsonPath().get("imageContent"));# 登录接口要用到deviceId,和imageContent是绑定的map.put("deviceId",response.jsonPath().get("deviceId"));return map;}/*** 下载验证码图片* */public static String getImageBase64(Map map){String[] resData = map.get("imageContent").toString().split(";");String base64Image = resData[2];String imageStr = base64Image.substring(base64Image.lastIndexOf(",")+1);return imageStr;}/*** @Method downloadImageCode() 下载base64字符串转码的图片* @param ImageStr base64字符串* @param ImagePath 下载地址前缀* */public static String downloadImageCode(String ImageStr,String ImagePath) {/** JDK11版本中针对sun.misc.BASE64Encoder 使用方法进行了修改升级.* jdk8中:*   BASE64Decoder decoder = new BASE64Decoder();*   byte[] bytes = decoder.decodeBuffer(str);* JDK11中变更为:java.util.Base64*   Base64.Decoder decoder = Base64.getMimeDecoder();*   byte[] bytes = decoder.decode(str);* */Base64.Decoder decoder = Base64.getDecoder();if (ImageStr == null) {return "下载失败";}String imageFilePath;try {byte[] b = decoder.decode(ImageStr);for (int i = 0; i < b.length; ++i) {if (b[i] < 0) {b[i] += 256;}}int rdm = (int) Math.random()*100;imageFilePath = ImagePath + System.currentTimeMillis() + rdm + ".png";OutputStream outputStream = new FileOutputStream(imageFilePath);outputStream.write(b);outputStream.flush();outputStream.close();} catch (Exception e) {return "下载失败";}return imageFilePath;}/*** 图片降噪处理,借鉴了某大佬的代码* */public static String removeBackground(String imagePath) {// RGB阈值int threshold = 500;String resultPath = null;try {BufferedImage bufferedImage = ImageIO.read(new File(imagePath));int width = bufferedImage.getWidth();int height = bufferedImage.getHeight();for (int x = 0; x < width; x++) {for (int y = 0; y < height; y++) {Color color = new Color(bufferedImage.getRGB(x, y));/*System.out.println("red:" + color.getRed() + ";green:" + color.getGreen() + ";blue:" + color.getBlue());*/int num = color.getRed() + color.getGreen() + color.getBlue();if (num >= threshold) {bufferedImage.setRGB(x, y, Color.WHITE.getRGB());}}}for (int i = 0; i < width; i++) {Color color1 = new Color(bufferedImage.getRGB(i, 1));int num1 = color1.getRed() + color1.getGreen() + color1.getBlue();for (int x = 0; x < width; x++) {for (int y = 0; y < height; y++) {Color color = new Color(bufferedImage.getRGB(x, y));int num = color.getRed() + color.getGreen() + color.getBlue();if (num == num1) {bufferedImage.setRGB(x, y, Color.WHITE.getRGB());} else {bufferedImage.setRGB(x, y, Color.BLACK.getRGB());}}}}resultPath = imagePath.substring(0, imagePath.lastIndexOf(".")) + "_1.png";File file = new File(resultPath);ImageIO.write(bufferedImage, "png", file);} catch (Exception e) {e.printStackTrace();}return resultPath.toString();}/*** 识别处理后的验证码图片* */public static String getImageCode(String ImageFilePath) {String result = null;try {Tesseract tesseract = new Tesseract();tesseract.setDatapath("C:/Program Files/Tesseract-OCR/tessdata");tesseract.setLanguage("eng");result = tesseract.doOCR(new File(ImageFilePath));} catch (Exception e) {e.printStackTrace();}return result;}
}
http://www.dtcms.com/wzjs/403242.html

相关文章:

  • 怎么增加网站反链互联网营销师培训教程
  • 上海做家教网站有哪些seo品牌优化
  • 剖析材料范文哪个网站做的好河北网站建设制作
  • 可以申请微信号的网站哈尔滨最新消息
  • 通辽市城乡建设局网站公司软文怎么写
  • 南宁小程序定制开发公司山东seo首页关键词优化
  • 咋样建设网站南宁百度seo软件
  • 给别人做金融网站 犯法吗关键词优化的作用
  • 可以做分析图的地图网站百度海南分公司
  • 2018建设网站搜索推广平台
  • 做网站什么最重要宣传软文怎么写
  • 如何让自己的网站排名靠前网建公司
  • 现在建站好么关键词首页排名优化价格
  • 幸福宝推广app网站下载h5下一页
  • 贵阳网站建设多少钱seo排名优化软件免费
  • 赣州seo推广谷歌seo网站运营
  • 网站建设人文类成人职业技能培训有哪些项目
  • 工作时做网站使用软件怎么自己制作一个网站
  • 做英国代购的公司网站石家庄网站建设方案优化
  • 深圳网站制作的公司深圳app开发企业营销策略
  • 牡丹江3d网站开发免费自助建站哪个最好
  • 网站建设技术标书百度快速排名提升
  • 只做av搬运工的网站最全bt搜索引擎入口
  • 做网站导航栏目怎么做谷歌浏览器下载手机版
  • 网站维护明细报价表长沙官网seo收费标准
  • 网站建设视频万网seo排名哪家正规
  • mrskinlove wordpress网站优化推广外包
  • 网站平台是怎么做财务的网络推广工作好干吗
  • 可以做旅行计划的网站考证培训机构
  • 网站建设电话销售开场白正规seo排名多少钱