Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3b1f22e3 time:316887865
- D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
- E/path: ---------------
- -/storage/extSdCard/DCIM/Camera/20181120_150225.jpg
- E/base64: -----/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwM........
- D/PhoneWindow: *FMB* installDecor mIsFloating : true
- *FMB* installDecor flags : 8388610
- W/ResourceType: Failure getting entry for 0x01080946 (t=7 e=2374) (error -75)
- I/Choreographer: Skipped 64 frames! The application may be doing too much work on its main thread.
- D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
- *FMB* isFloatingMenuEnabled return false
- W/: Unable to open '/system/framework/timakeystore.jar': No such file or directory
- W/art: Failed to open zip archive '/system/framework/timakeystore.jar': I/O Error
- I/System.out: Thread-115750(ApacheHTTPLog):Reading from variable values from setDefaultValuesToVariables
- I/System.out: Thread-115750(ApacheHTTPLog):isSBSettingEnabled false
- Thread-115750(ApacheHTTPLog):isShipBuild true
- Thread-115750(ApacheHTTPLog):SMARTBONDING_ENABLED is false
- Thread-115750(ApacheHTTPLog):SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
- I/System.out: AsyncTask #1 calls detatch()
- V/log_tag: In the try Loop<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
- <title>400 Bad Request</title>
- <p>The browser (or proxy) sent a request that this server could not understand.</p>
- D/InputMethodManager: windowDismissed mLockisused = false
- E/ViewRootImpl: sendUserActionEvent() mView == null
- V/ActivityThread: updateVisibility : ActivityRecord{31277cd1 token=android.os.BinderProxy@3b1f22e3 {com.example.user.ivrec/com.example.user.ivrec.MainActivity}} show : true "
- private void upload() {
- // Image location URL
- Log.e("path", "----------------" + picturePath);
- // Image
- Bitmap bm = BitmapFactory.decodeFile(picturePath);
- ByteArrayOutputStream bao = new ByteArrayOutputStream();
- bm.compress(Bitmap.CompressFormat.JPEG, 90, bao);
- byte[] ba = bao.toByteArray();
- ba1 = Base64.encodeToString(ba, Base64.NO_WRAP);
- Log.e("base64", "-----" + ba1);
- // Upload image to server
- new uploadToServer().execute();
- }
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == 100 && resultCode == RESULT_OK) {
- selectedImage = data.getData();
- photo = (Bitmap) data.getExtras().get("data");
- // Cursor to get image uri to display
- String[] filePathColumn = {MediaStore.Images.Media.DATA};
- Cursor cursor = getContentResolver().query(selectedImage,
- filePathColumn, null, null, null);
- cursor.moveToFirst();
- int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
- picturePath = cursor.getString(columnIndex);
- cursor.close();
- Bitmap photo = (Bitmap) data.getExtras().get("data");
- ImageView imageView = (ImageView) findViewById(R.id.Imageprev);
- imageView.setImageBitmap(photo);
- }
- }
- public class uploadToServer extends AsyncTask<Void, Void, String> {
- private ProgressDialog pd = new ProgressDialog(MainActivity.this);
- protected void onPreExecute() {
- super.onPreExecute();
- pd.setMessage("Wait image uploading!");
- pd.show();
- }
- @Override
- protected String doInBackground(Void... params) {
- ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
- nameValuePairs.add(new BasicNameValuePair("base64", ba1));
- nameValuePairs.add(new BasicNameValuePair("ImageName", System.currentTimeMillis() + ".jpg"));
- try {
- HttpClient httpclient = new DefaultHttpClient();
- HttpPost httppost = new HttpPost(URL);
- httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
- HttpResponse response = httpclient.execute(httppost);
- String st = EntityUtils.toString(response.getEntity());
- Log.v("log_tag", "In the try Loop" + st);
- } catch (Exception e) {
- Log.v("log_tag", "Error in http connection " + e.toString());
- }
- return "Success";
- }
- protected void onPostExecute(String result) {
- super.onPostExecute(result);
- pd.hide();
- pd.dismiss();
- }
- }
- #!flask/bin/python
- import os
- from flask import Flask, request, redirect, url_for, send_from_directory, json
- from werkzeug.utils import secure_filename
- import cv2
- UPLOAD_FOLDER = '/home/pi/Data'
- ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif', 'mp4', 'mkv', '3gp', 'webm'])
- app = Flask(__name__)
- app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
- @app.route('/', methods=['POST'])
- def make_recognition():
- #upload image
- file = request.files['image']
- f = os.path.join(app.config['UPLOAD_FOLDER'],
- secure_filename(f.filename))
- file.save(f)
- #find the number of faces in the photo
- img = cv2.imread(f.filename)
- gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- lbp_face_cascade = cv2.CascadeClassifier('/home/pi/opencv-3.3.0/data/lbpcascades/lbpcascade_frontalface.xml')
- faces = lbp_face_cascade.detectMultiScale(gray_img, scaleFactor=1.1, minNeighbors=5);
- recognition_result = len(faces)
- return recognition_result
- if __name__ == '__main__':
- app.run(host='0.0.0.0', debug=True)
Add Comment
Please, Sign In to add comment