Giter Club home page Giter Club logo

cognitive-vision-android's Introduction

Microsoft Computer Vision API: Android Client Library & Sample

This repo contains the Android client library & sample for the Microsoft Computer Vision API, an offering within Microsoft Cognitive Services, formerly known as Project Oxford.

The Client Library

The client library is a thin Java client wrapper for the Computer Vision API.

The easiest way to consume the client library is to add com.microsoft.projectoxford.vision package from Maven Central Repository. To find the latest version of client library, go to http://search.maven.org, and search for "com.microsoft.projectoxford".

To add the client library dependency from build.gradle file, add the following line in dependencies.

dependencies {
    //
    // Use the following line to include client library from Maven Central Repository
    // Change the version number from the search.maven.org result
    //
    compile 'com.microsoft.projectoxford:vision:1.0.394'

    // Your other Dependencies...
}

To do add the client library dependency from Android Studio:

  1. From Menu, Choose File > Project Structure

  2. Click on your app module

  3. Click on Dependencies tab

  4. Click "+" sign to add new dependency

  5. Pick "Library dependency" from the drop down list

  6. Type "com.microsoft.projectoxford" and hit the search icon from "Choose Library Dependency" dialog

  7. Pick the Project Oxford client library that you intend to use.

  8. Click "OK" to add the new dependency

The Sample

This sample is an Android application to demonstrate the use of the Computer Vision API. It demonstrates image analysis, Optical Character Recognition (OCR), and smart thumbnail generation.

Requirements

Android OS must be Android 4.1 or higher (API Level 16 or higher)

Build the Sample

  1. First, you must obtain a Computer Vision API key by following the instructions on our website.

  2. Start Android Studio and open project from Vision > Android > Sample folder.

  3. In Android Studio -> "Project" panel -> "Android" view, open file "app/res/values/strings.xml", and find the keys subscription_key and subscription_apiroot. Replace the placeholder values with those obtained in step 1 above. If you cannot find the file "strings.xml", it is in folder "Sample\app\src\main\res\values\string.xml".

  4. In Android Studio, select menu "Build > Make Project" to build the sample, and "Run" to launch this sample app.

Run the Sample

In Android Studio, select menu "Run", and "Run app" to launch this sample app.

Once the app is launched, click on buttons to use samples of between different scenarios, and follow the instructions on screen.

Microsoft will receive the images you upload and may use them to improve the Computer Vision API and related services. By submitting an image, you confirm you have consent from everyone in it.

Contributing

We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can. Learn more about how you can help on our Contribution Rules & Guidelines.

You can reach out to us anytime with questions and suggestions using our communities below:

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

All Microsoft Cognitive Services SDKs and samples are licensed with the MIT License. For more details, see LICENSE.

Sample images are licensed separately, please refer to LICENSE-IMAGE.

Developer Code of Conduct

Developers using Cognitive Services, including this client library & sample, are expected to follow the “Developer Code of Conduct for Microsoft Cognitive Services”, found at http://go.microsoft.com/fwlink/?LinkId=698895.

cognitive-vision-android's People

Contributors

alexander7161 avatar allenmmo avatar chsienki avatar cthrash avatar kialandi avatar lightfrenzy avatar microsoft-github-policy-service[bot] avatar miparnisari avatar msftgits avatar paolorotolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cognitive-vision-android's Issues

How to merge two microsoft sample apps

How can I join https://github.com/Microsoft/Cognitive-Vision-Android with https://github.com/Microsoft/Cognitive-Face-Android so that both apps are combined into one. As I was looking to make an app which combined both technologies to help blind people familiarise themselves with certain things by letting them know what it is. Can you please send me the file/folder with the solution by providing a link to it and how and where I can use it as I'm pretty new to android app development. When someone provides the code I need to know where to add it and test it that it works. So basically I am trying to create a similar app to Seeing AI. All help is well appreciated. Thanks

Failed to get thumbnail

The class VisionServiceRestClient calls REST url that create the thumbnail incorrectly.

  • Incorrect
public byte[] getThumbnail(int width, int height, boolean smartCropping, InputStream stream) throws VisionServiceException, IOException {
    ---
        
    String path = this.apiRoot + "/generateThumbnails";
        
    ---     
}
  • Correct
public byte[] getThumbnail(int width, int height, boolean smartCropping, InputStream stream) throws VisionServiceException, IOException {
    ---
        
    String path = this.apiRoot + "/generateThumbnail";
        
    ---     
}

Error code 401

After fill subscription_key in string.xml, when using text recognize service, it says:
error executing post request, received error code 401

Project Oxford vision samples has stopped

Project Oxford vision samples has stopped open app again error message occurs when I go to Recognize text tab and then click on select image. This repeatedly happens whenever I try to use Recognize text.

How to use multiple API

i am trying face API in android
but i have two API one for detection And another one for identify how i use two API in Android...

Error:Execution failed for task

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

hostname in certificate didn't match: <southeastasia.api.cognitive.microsoft.com> != <*.cognitiveservices.azure.com> OR <*.cognitiveservices.azure.com>

Cognitive vision api gives error in OPPO devices. It works with other device but getting error in my OPPO device

The following error shows in log :
hostname in certificate didn't match: <southeastasia.api.cognitive.microsoft.com> != <.cognitiveservices.azure.com> OR <.cognitiveservices.azure.com>

I think this issue is similar with face detection api.
please help me on this.

build error - unknown element <library> found

C:\WS\Cognitive-Vision-Android-
master\Sample\app\build\intermediates\manifests\full\debug\AndroidManifest.xml
Error:(15) error: unknown element found.
Error:(15) unknown element found.

error

Confidence

Hi what is the general rule of thumb for the confidence in Microsoft Cognitive Services? Do you have any graph or anything available which states if it is less than 50% don't trust the results and if it is above 50% do trust the results. Like also if it is 90%+ it is extremely accurate results etc.

how to set the language parameter at using image describe

I want to image describe function in different language.
When using image describe python API I can use as following
description_results = computervision_client.describe_image(remote_image_url,max_candidates=1 , language="ja" )
but in android SDK there is no such API to set image describe language.

Error Executing POST Request! Code: 401

Hi,

Trying to use the computer vision API. All my subscription keys are correct, and the code is solid, with the only difference being that I take a photo instead of a selection of an existing one. All of this is also solid (no nullpointers here).

What does error 401 refer to? A quick google reveals it relates to permissions, how so?

Android 3.0 POST Error 401 Trial

I'm using Android SDK API 26 with new Android Studio 3.0. I managed to successfully compile it... I signed up for a free 30 day trial for MSFT cog serverics, Computer Vision API to test it out, I tried both subscription keys for Computer Vision API Version 1.0. I Can't find where I can change my endpoint and both keys fail... Is something internally wrong with Microsoft?

https://puu.sh/y8G4H/261e12d7ce.png

I get this in Logcat, which is definitely something wrong with API. I can't fix an API: what should I do to get it working?

`10-27 13:14:12.207 16907-16907/com.microsoft.projectoxford.visionsample D/AnalyzeActivity: onActivityResult

10-27 13:14:12.530 16907-16907/com.microsoft.projectoxford.visionsample I/ExifInterface_JNI: Raw image not detected

10-27 13:14:12.530 16907-16907/com.microsoft.projectoxford.visionsample W/ExifInterface: Skip the tag entry since tag number is not defined: 2

10-27 13:14:12.561 16907-16907/com.microsoft.projectoxford.visionsample D/AnalyzeActivity: Image: file:///storage/emulated/0/Android/data/com.microsoft.projectoxford.visionsample/files/Pictures/IMG_1139534705.jpg resized to 720x1280

10-27 13:14:12.646 16907-16907/com.microsoft.projectoxford.visionsample I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3c58e56 time:922156746

10-27 13:14:13.540 16907-19650/com.microsoft.projectoxford.visionsample W/DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {azureapimanagementkey=WWW-Authenticate: AzureApiManagementKey realm="https://westus.api.cognitive.microsoft.com/vision/v1.0",name="Ocp-Apim-Subscription-Key",type="header"}`

Adding Api Key

Build the Sample

First, you must obtain a ""Video API subscription key"" by following the instructions on our website.
This does't work.
When I replaced it with "Computer Vision API key" then it worked .
So probably change must me made in Read me instructions if I am right.
Thanks

build error

I can't build sample from this repository. i am getting below errors on build or run the app:

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.apache.commons.lang.builder.HashCodeBuilder$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.apache.commons.lang.builder.ToStringStyle$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.

Remove usage of TextUtils from VisionServiceRestClient

The class VisionServiceRestClient uses a utility class TextUtils from android to convert a String[] to a String using a delimiter. However this makes it difficult to use this Java API outside of Android. If you could change it to use String.join(delimiter, array) this would remove the dependency of the client on Android libraries. However String.join is available only on Java 8 and above, so using Apache Common's StringUtils.join would be a better approach.

Thanks,
Sushil

Unable to find dependency

Type "com.microsoft.projectoxford" and hit the search icon from "Choose Library Dependency" dialog
when navigate to this option then no results found message is getting displayed
what to do with that?

Error adding API key

Error when attaching API key in strings.xml file, not accessing endpoint

Error: Target host must not be null, or set in parameters. scheme=null, host=null, path=(subscription-key)/analyze

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.