1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| String OtherServerPath = "http://localhost:7999/pic";
Map<String, String> textMap = new HashMap<String, String>();
Map<String, String> fileMap = new HashMap<String, String>(); fileMap.put("upload", fileName); String contentType = ""; String ret = formUpload(OtherServerPath, textMap, fileMap, contentType);
JSONObject jsonObject = JSONObject.fromString(ret); Iterator myNames = jsonObject.keys(); while(myNames.hasNext()){ String name = (String)myNames.next(); JSONObject inner = (JSONObject) jsonObject.get(name); JSONArray innerBox = (JSONArray) inner.get("boxes"); Double[] box = {innerBox.getDouble(0), innerBox.getDouble(1), innerBox.getDouble(2), innerBox.getDouble(3)}; RecognizeResult recognizeResult = new RecognizeResult(name, box, (Double)inner.get("similarity")); System.out.println(recognizeResult); recognizeResults.add(recognizeResult); }
|