Guest User

Untitled

a guest
Nov 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. " I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3b1f22e3 time:316887865
  2. D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
  3. E/path: ---------------
  4. -/storage/extSdCard/DCIM/Camera/20181120_150225.jpg
  5. E/base64: -----/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwM........
  6. D/PhoneWindow: *FMB* installDecor mIsFloating : true
  7. *FMB* installDecor flags : 8388610
  8. W/ResourceType: Failure getting entry for 0x01080946 (t=7 e=2374) (error -75)
  9. I/Choreographer: Skipped 64 frames! The application may be doing too much work on its main thread.
  10. D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
  11. *FMB* isFloatingMenuEnabled return false
  12. W/: Unable to open '/system/framework/timakeystore.jar': No such file or directory
  13. W/art: Failed to open zip archive '/system/framework/timakeystore.jar': I/O Error
  14. I/System.out: Thread-115750(ApacheHTTPLog):Reading from variable values from setDefaultValuesToVariables
  15. I/System.out: Thread-115750(ApacheHTTPLog):isSBSettingEnabled false
  16. Thread-115750(ApacheHTTPLog):isShipBuild true
  17. Thread-115750(ApacheHTTPLog):SMARTBONDING_ENABLED is false
  18. Thread-115750(ApacheHTTPLog):SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
  19. I/System.out: AsyncTask #1 calls detatch()
  20. V/log_tag: In the try Loop<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  21. <title>400 Bad Request</title>
  22.  
  23. <p>The browser (or proxy) sent a request that this server could not understand.</p>
  24. D/InputMethodManager: windowDismissed mLockisused = false
  25. E/ViewRootImpl: sendUserActionEvent() mView == null
  26. V/ActivityThread: updateVisibility : ActivityRecord{31277cd1 token=android.os.BinderProxy@3b1f22e3 {com.example.user.ivrec/com.example.user.ivrec.MainActivity}} show : true "
  27.  
  28. private void upload() {
  29. // Image location URL
  30. Log.e("path", "----------------" + picturePath);
  31.  
  32. // Image
  33. Bitmap bm = BitmapFactory.decodeFile(picturePath);
  34. ByteArrayOutputStream bao = new ByteArrayOutputStream();
  35. bm.compress(Bitmap.CompressFormat.JPEG, 90, bao);
  36. byte[] ba = bao.toByteArray();
  37. ba1 = Base64.encodeToString(ba, Base64.NO_WRAP);
  38.  
  39. Log.e("base64", "-----" + ba1);
  40.  
  41. // Upload image to server
  42. new uploadToServer().execute();
  43.  
  44. }
  45.  
  46. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  47. if (requestCode == 100 && resultCode == RESULT_OK) {
  48.  
  49. selectedImage = data.getData();
  50. photo = (Bitmap) data.getExtras().get("data");
  51.  
  52. // Cursor to get image uri to display
  53.  
  54. String[] filePathColumn = {MediaStore.Images.Media.DATA};
  55. Cursor cursor = getContentResolver().query(selectedImage,
  56. filePathColumn, null, null, null);
  57. cursor.moveToFirst();
  58.  
  59. int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
  60. picturePath = cursor.getString(columnIndex);
  61. cursor.close();
  62.  
  63. Bitmap photo = (Bitmap) data.getExtras().get("data");
  64. ImageView imageView = (ImageView) findViewById(R.id.Imageprev);
  65. imageView.setImageBitmap(photo);
  66. }
  67. }
  68.  
  69. public class uploadToServer extends AsyncTask<Void, Void, String> {
  70.  
  71. private ProgressDialog pd = new ProgressDialog(MainActivity.this);
  72. protected void onPreExecute() {
  73. super.onPreExecute();
  74. pd.setMessage("Wait image uploading!");
  75. pd.show();
  76. }
  77.  
  78. @Override
  79. protected String doInBackground(Void... params) {
  80.  
  81. ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
  82. nameValuePairs.add(new BasicNameValuePair("base64", ba1));
  83. nameValuePairs.add(new BasicNameValuePair("ImageName", System.currentTimeMillis() + ".jpg"));
  84. try {
  85. HttpClient httpclient = new DefaultHttpClient();
  86. HttpPost httppost = new HttpPost(URL);
  87. httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  88. HttpResponse response = httpclient.execute(httppost);
  89. String st = EntityUtils.toString(response.getEntity());
  90. Log.v("log_tag", "In the try Loop" + st);
  91.  
  92. } catch (Exception e) {
  93. Log.v("log_tag", "Error in http connection " + e.toString());
  94. }
  95. return "Success";
  96. }
  97.  
  98. protected void onPostExecute(String result) {
  99. super.onPostExecute(result);
  100. pd.hide();
  101. pd.dismiss();
  102. }
  103. }
  104.  
  105. #!flask/bin/python
  106. import os
  107. from flask import Flask, request, redirect, url_for, send_from_directory, json
  108. from werkzeug.utils import secure_filename
  109. import cv2
  110.  
  111. UPLOAD_FOLDER = '/home/pi/Data'
  112. ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif', 'mp4', 'mkv', '3gp', 'webm'])
  113.  
  114. app = Flask(__name__)
  115. app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
  116.  
  117. @app.route('/', methods=['POST'])
  118. def make_recognition():
  119.  
  120. #upload image
  121. file = request.files['image']
  122. f = os.path.join(app.config['UPLOAD_FOLDER'],
  123. secure_filename(f.filename))
  124. file.save(f)
  125.  
  126. #find the number of faces in the photo
  127. img = cv2.imread(f.filename)
  128. gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  129. lbp_face_cascade = cv2.CascadeClassifier('/home/pi/opencv-3.3.0/data/lbpcascades/lbpcascade_frontalface.xml')
  130. faces = lbp_face_cascade.detectMultiScale(gray_img, scaleFactor=1.1, minNeighbors=5);
  131. recognition_result = len(faces)
  132.  
  133. return recognition_result
  134.  
  135.  
  136. if __name__ == '__main__':
  137. app.run(host='0.0.0.0', debug=True)
Add Comment
Please, Sign In to add comment