地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.javaweb.third.baidu.service;
 
 
import com.javaweb.third.baidu.api.ImageClassifyAPI;
import com.javaweb.third.baidu.bean.imgClassify.*;
import com.javaweb.third.baidu.util.ImageUtil;
 
/**
 * @author wujiyue
 */
public class ImageClassifyService {
    public static void main(String[] args){
       /* String path="C:\\Users\\wjy\\Desktop\\dish.jpg";
        DishResult result = dish(path);
        System.out.println(result);*/
 
        /*String path="C:\\Users\\wjy\\Desktop\\logo.jpg";
        LogoResult result = logo(path);
        System.out.println(result);*/
 
        /*String path="C:\\Users\\wjy\\Desktop\\plant.jpg";
        PlantResult result = plant(path);
        System.out.println(result);*/
 
        /*String path="C:\\Users\\wjy\\Desktop\\car.jpg";
        AnimalResult result = animal(path);
        System.out.println(result);*/
 
        String path="C:\\Users\\wjy\\Desktop\\timg.jpg";
        ObjectDetectResult result = object_detect(path);
        System.out.println(result);
       String b= ImageUtil.paintRectangle(path, result.getLocation());
        System.out.println(b);
    }
 
 
    public static DishResult dish(String path){
        String json= ImageClassifyAPI.dish(path, 3);
        return DishResult.create(json);
    }
    public static CarResult car(String path){
        String json= ImageClassifyAPI.car(path, 3);
        return CarResult.create(json);
    }
    public static LogoResult logo(String path){
        String json= ImageClassifyAPI.logo(path, false);
        return LogoResult.create(json);
    }
    public static PlantResult plant(String path){
        String json= ImageClassifyAPI.plant(path);
        return PlantResult.create(json);
    }
    public static AnimalResult animal(String path){
        String json= ImageClassifyAPI.animal(path, 3);
        return AnimalResult.create(json);
    }
    //主体对象检测
    public static ObjectDetectResult object_detect(String path){
        String json= ImageClassifyAPI.object_detect(path, false);
        return ObjectDetectResult.create(json);
    }
 
}