MCPcopy Create free account
hub / github.com/MrFuFuFu/RxFace / run

Method run

sdk_unuse/MainActivity.java:205–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203 new Thread(new Runnable() {
204
205 public void run() {
206 HttpRequests httpRequests = new HttpRequests("4480afa9b8b364e30ba03819f3e9eff5", "Pz9VFT8AP3g_Pz8_dz84cRY_bz8_Pz8M", true, false);
207 //Log.v(TAG, "image size : " + img.getWidth() + " " + img.getHeight());
208
209 ByteArrayOutputStream stream = new ByteArrayOutputStream();
210 float scale = Math.min(1, Math.min(600f / img.getWidth(), 600f / img.getHeight()));
211 Matrix matrix = new Matrix();
212 matrix.postScale(scale, scale);
213
214 Bitmap imgSmall = Bitmap.createBitmap(img, 0, 0, img.getWidth(), img.getHeight(), matrix, false);
215 //Log.v(TAG, "imgSmall size : " + imgSmall.getWidth() + " " + imgSmall.getHeight());
216
217 imgSmall.compress(Bitmap.CompressFormat.JPEG, 100, stream);
218 byte[] array = stream.toByteArray();
219
220 try {
221 //detect
222 JSONObject result = httpRequests.detectionDetect(new PostParameters().setImg(array));
223 //finished , then call the callback function
224 if (callback != null) {
225 callback.detectResult(result);
226 }
227 } catch (FaceppParseException e) {
228 e.printStackTrace();
229 MainActivity.this.runOnUiThread(new Runnable() {
230 public void run() {
231 textView.setText("Network error.");
232 }
233 });
234 }
235
236 }
237 }).start();
238 }
239 }

Callers

nothing calls this directly

Calls 3

detectionDetectMethod · 0.95
setImgMethod · 0.80
detectResultMethod · 0.65

Tested by

no test coverage detected