Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
- import com.huawei.hiai.vision.visionkit.common.Frame;//Load the Frame class.
- import com.huawei.hiai.vision.visionkit.common.Video;//Load the video class.
- import com.huawei.hiai.vision.visionkit.image.detector.AestheticsScore;//Load the aesthetic engine result class.
- import com.huawei.hiai.vision.image.detector.AestheticsScoreDetector;//Load the detector class of aesthetic engine.
- import com.huawei.hiai.vision.common.VisionBase;//Load the static class for connecting to the service.
- import com.huawei.hiai.vision.common.ConnectionCallback;//Load the callback for connecting to the service.
- import com.huawei.hiai.vision.visionkit.image.detector.AEVideoResult;//Load the aesthetic engine video result class.
- import com.huawei.hiai.vision.visionkit.image.detector.AEModelConfiguration;
- import com.google.gson.Gson;
- VisionBase.init(mContext, new ConnectionCallback(){
- @Override
- public void onServiceConnect(){
- Log.i(LOG_TAG, "onServiceConnect");
- }
-
- @Override
- public void onServiceDisconnect(){
- Log.i(LOG_TAG, "onServiceDisconnect");
- }
- });
- AestheticsScoreDetector aestheticsScoreDetector = new AestheticsScoreDetector(mContext);
- AEModelConfiguration aeModelConfiguration = new AEModelConfiguration();
- aeModelConfiguration.getDetetcImageConf().setDetectImageMode(3)
- aestheticsScoreDetector.setAEModelConfiguration(aeModelConfiguration);
- VisionImage image= null;
- image = VisionImage.fromBitmap(bitmap);
- AestheticsScore outputData = new AestheticsScore();
- int resultCode = mAestheticsScoreDetector.detectImage(image, outputData, null);
- float score = aestheticsScores.getScore();
- float timeStamp = aestheticsScores.getFrameTimeStamp();
- float ospScore = aestheticsScores.getOSPScores();
- float hfScore = aestheticsScores.getHFSCore();