zoukankan      html  css  js  c++  java
  • java 图片八分标

        public void import6(){
            TagImgFilter filter = new TagImgFilter();
            filter.setEq_orgId("c1fa7ba875fa4c9a899e2787eb79e802");
            filter.setEq_setId("69f98b9be4174842a101b211ae0058c5");
            filter.setEq_typeId("0835426e62e24b309272cd73f58d0fee");
            
            filter.setNull_tagJson(false);// 是否要有标注的,true是没标注
            
            List<TagImg> imgList = tagImgService.selectAll(filter);
            System.out.println(imgList.size());
            
            int countadd = 0;
            for (TagImg tagimg : imgList) {
                countadd++;
                System.out.println(countadd);
                
                JSONArray array=JSONArray.parseArray(tagimg.getTagJson());//得到原来大框的json
                JSONObject jsonObj = array.getJSONObject(0);
                
                JSONArray arrayNew=new JSONArray();
                int j = 0;
                for(int i=1;i<=8;i++){
                    JSONObject obj = new JSONObject();                    
                    if(i%2!=0){//单数1、3、5、7
                        obj.put("x", jsonObj.getDouble("x"));
                        obj.put("y", jsonObj.getDouble("y")+(jsonObj.getDouble("height")/4)*j);    
                    }else{//双数2、4、6、8
                        obj.put("x", jsonObj.getDouble("x")+jsonObj.getDouble("width")/2);
                        obj.put("y", jsonObj.getDouble("y")+(jsonObj.getDouble("height")/4)*j);
                        j++;
                    }
                    obj.put("width", jsonObj.getDouble("width")/2);
                    obj.put("height",jsonObj.getDouble("height")/4);
                    obj.put("mark", i);                
                    arrayNew.add(obj);
                }
                System.out.println(arrayNew);
                
                tagimg.setTagJson(arrayNew.toString());// 带了标注
                tagImgService.save(tagimg);
            }
            /*if(countadd==1){
                  break;
              }*/
        }
  • 相关阅读:
    前端大文件上传方法(深度好文)
    windows版idea 2018.3.5版 永久激活教程
    性能优化随笔
    使用java画一张海报
    Gson杂记录
    Gson转Map时,Int会变成double解决方法
    浅析VO、DTO、DO、PO的概念、区别和用处
    SpringCloud框架搭建+实际例子+讲解+系列五
    raid总结
    MD5与SHA1
  • 原文地址:https://www.cnblogs.com/lely/p/10364590.html
Copyright © 2011-2022 走看看