当前位置: 首页>>代码示例>>Java>>正文


Java FaceppParseException类代码示例

本文整理汇总了Java中com.facepp.error.FaceppParseException的典型用法代码示例。如果您正苦于以下问题:Java FaceppParseException类的具体用法?Java FaceppParseException怎么用?Java FaceppParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FaceppParseException类属于com.facepp.error包,在下文中一共展示了FaceppParseException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detect

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
public void detect(final Bitmap bmp, final Callback callback)
{
    new Thread(new Runnable()
    {
        @Override
        public void run()
        {
            try {
                HttpRequests requests = new HttpRequests(Constant.API_KEY, Constant.API_SECRET, true, true);
                Bitmap bmpSamll = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight());
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                bmpSamll.compress(Bitmap.CompressFormat.JPEG, 70, stream);      // 压缩
                byte[] arrays = stream.toByteArray();

                PostParameters params = new PostParameters();
                params.setImg(arrays);

                // 人脸检测
                JSONObject jsonObject = requests.detectionDetect(params);
                Log.d("TAG", jsonObject.toString());
                if (callback != null) {
                    callback.success(jsonObject);
                }
            } catch (FaceppParseException e) {
                e.printStackTrace();
                if (callback != null) {
                    callback.error(e);
                }
            }
        }
    }).start();
}
 
开发者ID:VernonVan,项目名称:Face,代码行数:33,代码来源:FaceppDetect.java

示例2: TrainGroup

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
private void TrainGroup() {
	new Thread(new Runnable() {
		@Override
		public void run() {
			JSONObject syncRet = null;
			try {
				syncRet = httpRequests.trainIdentify(new PostParameters()
						.setGroupName("my_group"));
				System.out.println("train group session:"
						+ syncRet.toString());

			} catch (FaceppParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}

	}).start();

}
 
开发者ID:ColinBin,项目名称:face_detection,代码行数:22,代码来源:CollectFaceDataFragment.java

示例3: detect

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
public static void detect(final Bitmap bm, final CallBack callBack) {
	new Thread(new Runnable() {

		@Override
		public void run() {
			// request

			try {
				HttpRequests requests = new HttpRequests(KEY, SECRET, true,
						true);
				Bitmap bmSmall = Bitmap.createBitmap(bm, 0, 0,
						bm.getWidth(), bm.getHeight());
				ByteArrayOutputStream stream = new ByteArrayOutputStream();
				bmSmall.compress(Bitmap.CompressFormat.JPEG, 100, stream);

				byte[] arrays = stream.toByteArray();

				PostParameters params = new PostParameters();
				params.setImg(arrays);
				JSONObject jsonObject = requests.detectionDetect(params);

				// Log
				Log.i("TAG", jsonObject.toString());

				if (callBack != null) {
					callBack.success(jsonObject);
				}
			} catch (FaceppParseException e) {
				e.printStackTrace();
				if (callBack != null) {
					callBack.error(e);
				}
			}

		}
	}).start();

}
 
开发者ID:HuaDanJson,项目名称:FaceAI_Android,代码行数:39,代码来源:FaceppDetect.java

示例4: detect

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
public void detect(final Bitmap image) {

			new Thread(new Runnable() {
				@Override
				public void run() {

					ByteArrayOutputStream stream = new ByteArrayOutputStream();
					img.compress(Bitmap.CompressFormat.JPEG, 100, stream);
					imageArray = stream.toByteArray();

					try {
						// detect
						JSONObject result = httpRequests
								.detectionDetect(new PostParameters()
										.setImg(imageArray));
						// finished , then call the callback function
						if (callback != null) {
							callback.detectResult(result);
						}
					} catch (FaceppParseException e) {
						e.printStackTrace();
						getActivity().runOnUiThread(new Runnable() {
							public void run() {
								Toast.makeText(inflater.getContext(), "�������",
										Toast.LENGTH_SHORT).show();
							}
						});
					}

				}
			}).start();
		}
 
开发者ID:ColinBin,项目名称:face_detection,代码行数:33,代码来源:CollectFaceDataFragment.java

示例5: detect

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
public void detect(final Bitmap image) {

            new Thread(new Runnable() {

                public void run() {
                    HttpRequests httpRequests = new HttpRequests(
                            "8a6935b89012418fad0e9b3328bbeba9",
                            "WQN_MfSnt5Frtmy0XYeKJ8fh1xIVAmo_", true, false);
                    // Log.v(TAG, "image size : " + img.getWidth() + " " +
                    // img.getHeight());

                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    float scale = Math.min(
                            1,
                            Math.min(600f / img.getWidth(),
                                    600f / img.getHeight()));
                    Matrix matrix = new Matrix();
                    matrix.postScale(scale, scale);

                    Bitmap imgSmall = Bitmap.createBitmap(img, 0, 0,
                            img.getWidth(), img.getHeight(), matrix, false);
                    // Log.v(TAG, "imgSmall size : " + imgSmall.getWidth() + " "
                    // + imgSmall.getHeight());

                    imgSmall.compress(Bitmap.CompressFormat.JPEG, 100, stream);
                    byte[] array = stream.toByteArray();

                    try {
                        // detect
                        JSONObject result = httpRequests
                                .detectionDetect(new PostParameters()
                                        .setImg(array));
                        // finished , then call the callback function
                        if (callback != null) {
                            callback.detectResult(result);
                        }
                    } catch (FaceppParseException e) {
                        e.printStackTrace();
                        FindHowOldAct.this.runOnUiThread(new Runnable() {
                            public void run() {
                                SystemUtils.checkNetWork(FindHowOldAct.this);
                                textView.setText("error.");
                            }
                        });
                    }

                }
            }).start();
        }
 
开发者ID:absentm,项目名称:myapplication,代码行数:50,代码来源:FindHowOldAct.java

示例6: recogenition

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
public static void recogenition(final File file){

        new Thread(new Runnable() {
            @Override
            public void run() {
                HttpRequests httpRequests = new HttpRequests(Global.FACEPP_KEY, Global.FACEPP_SECRET);
                PostParameters postParameters = new PostParameters().setImg(file).setAttribute("all");

                try {
                   // postParameters.getMultiPart().writeTo(System.out);

                    JSONObject result =   httpRequests.detectionDetect(postParameters);

                    System.out.println(result.toString());



                } catch (FaceppParseException e) {
                    e.printStackTrace();
                }
            }
        }).start();

    }
 
开发者ID:hss01248,项目名称:FaceDetect,代码行数:25,代码来源:FaceNet.java

示例7: run

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
/**
 * 无锁并发:对需要处理的文件id取模分段,不同线程处理不同的文件
 * 如m个文件n个线程则 1号线程处理 1,1+n,1+2n...1+kn 号文件(1+kn<m)
 */
@Override
public void run() {
	int threadId = Integer.parseInt(Thread.currentThread().getName());
	int fileId = threadId;
	while(fileId < list.size()){
		File file = list.get(fileId);
		fileId += Config.threadNum;
		
		//过滤
		JSONObject result = null;
		try {
			result = httpRequests.detectionDetect(new PostParameters()
			.setImg(file).setAttribute("gender"));
		} catch (FaceppParseException e) {
			System.out.println("Error:\tThread-" + threadId + "\tFile-"+fileId + "\t" + file.getName() + " => " + e.getErrorMessage());
			continue;
		}
		//检查是不是很多白色像素来去表情包
		if(file.length() < Config.whiteRGBFileSizeMax){
			if(FileUtils.isImageWhite(file,Config.whiteRGBMin,Config.whiteRGBRate)){
				continue;
			}
		}
		
		String gender = getGenderOrNull(result);
		if (null == gender) {
		}else{
			int index = -9999;
			if("Female".equals(gender)){
				index = femaleIndex.getAndIncrement();
			}else{
				index = maleIndex.getAndIncrement();
			}
			
			//有些图片是.null后缀如 : ZJ0P65PZN$CW6IU)2PJVMDQ.null
			String destSuffix = FileUtils.getFileSuffix(file);
			if(destSuffix.equals("null")){
				destSuffix = "jpg";
			}
			FileUtils.fileChannelCopy(file, new File(Config.destPath
					+ "\\" + gender + "\\" + index + "." + destSuffix));

			if(Config.delSrcFile){	//删源文件
				file.delete();
			}
		}
	}
}
 
开发者ID:wintercoder,项目名称:QGroupFace,代码行数:53,代码来源:FileThread.java

示例8: detect

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
public void detect(final Bitmap image) {
    		
    		new Thread(new Runnable() {
				
				public void run() {
					HttpRequests httpRequests = new HttpRequests("48e076d2628e91534e6f2175cd7f8003", "pV22Bbbs-xn-XW4-f2ZpiNaUolEt3sAD", true, false);
		      		//Log.v(TAG, "image size : " + img.getWidth() + " " + img.getHeight());
		    		
		    		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		    		
		    	  
		    		float scale = Math.min(1, Math.min(600f / img.getWidth(), 600f / img.getHeight()));
		    		Matrix matrix = new Matrix();
		    		matrix.postScale(scale, scale);

		    		Bitmap imgSmall = Bitmap.createBitmap(img, 0, 0, img.getWidth(), img.getHeight(), matrix, false);
		    		//Log.v(TAG, "imgSmall size : " + imgSmall.getWidth() + " " + imgSmall.getHeight());
		    		
		    		imgSmall.compress(Bitmap.CompressFormat.JPEG, 100, stream);
		    		
		    		byte[] array = stream.toByteArray();
		    		
		    		try {
		    			//detect
						JSONObject result = httpRequests.detectionDetect(new PostParameters().setImg(array));
						//��ɣ������ص�����
						if (callback != null) {
							callback.detectResult(result);
							System.out.println(result);
							
						}
					} catch (FaceppParseException e) {
						e.printStackTrace();
						MainActivity.this.runOnUiThread(new Runnable() {
							public void run() {
//								textView.setText("�����쳣.");
								Toast.makeText(MainActivity.this, "�����쳣����������Ƿ�������", Toast.LENGTH_LONG).show();
							}
						});
					}
					
				}
			}).start();
    		
    	}
 
开发者ID:zhongbaitu,项目名称:MAKEYOURFACE,代码行数:46,代码来源:MainActivity.java

示例9: error

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
void error(FaceppParseException exception); 
开发者ID:HuaDanJson,项目名称:FaceAI_Android,代码行数:2,代码来源:FaceppDetect.java

示例10: error

import com.facepp.error.FaceppParseException; //导入依赖的package包/类
void error(FaceppParseException e); 
开发者ID:boliu-mobile,项目名称:SmartFace,代码行数:2,代码来源:FaceDetect.java


注:本文中的com.facepp.error.FaceppParseException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。