iMicknl / cordova-plugin-openalpr

This Cordova plugin adds support for the OpenALPR (Automatic License Plate Recognition) library, which provides support for retrieving the license plate from a picture.
MIT License
33 stars 23 forks source link

Scanning retunrs nothing #33

Closed mihaibalaban closed 6 years ago

mihaibalaban commented 6 years ago

I pass image from the camera to scanning function form plugin and the function isn't returning nothing and there is no error.

iMicknl commented 6 years ago

Please add more information;

mihaibalaban commented 6 years ago

Platform android plugin version: 2.0.1

and this is the code: cameraPlate() { this.camera.getPicture( { quality: 100, destinationType: this.camera.DestinationType.FILE_URI, sourceType: this.camera.PictureSourceType.CAMERA, encodingType: this.camera.EncodingType.JPEG, mediaType: this.camera.MediaType.PICTURE, saveToPhotoAlbum: false, cameraDirection: this.camera.Direction.FRONT, targetWidth: 500, targetHeight: 500, allowEdit: false, } ).then(imageData => { this.photo = imageData; this.openALPR.scan(this.photo).then( (result: [OpenALPRResult]) => { console.log(result[0].number) console.log(result) }),

    (error => {
      console.error('eroare: ' + error)
    });
}), (error => {
  alert('eraore:' + error)
  console.log(error)
});

}

iMicknl commented 6 years ago

Please provide all the information I requested in my previous response. Have you tried debugging using Android Studio / other tools already?

mihaibalaban commented 6 years ago

i am using the default region, and the image is this http://www.plateshack.com/y2k/Austria2/austriasteiermark.jpg , thanks

melvinversluijs commented 6 years ago

Hi @mihaibalaban, I've tried reading the image you provided with our sample application (https://github.com/melvinversluijs/ionic3-sample), and this works fine.

Could you try removing the allowEdit options from your CameraOptions? The Cordova Camera docs clearly states that this is bugged for Android and should not be used (https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/#android-quirks). Also the targetWidth and targetHeight, this is probably not to good for the image quality either. Lastly using the front camera for taking an image of a license plate also seems a bit weird.

You can use our sample application as reference.

Hope this helps.

Kind regards, Melvin

mihaibalaban commented 6 years ago

Thanks, melvinversluijs, now it works but i have to take the pictures in landscape.

beard7 commented 5 years ago

Hi,

I've managed to update the plugin.xml file so I can get it working on Android platform 7.1.x, which is great.

However, I'm also finding that I am forced to take pictures in landscape mode. Is there a workaround for this? I've tried adding correctOrientation: true to the camera options, but it doesn't make any difference.

Any ideas?

iMicknl commented 5 years ago

@beard7 could you please create a new issue to track your specific problem? And would you mind creating a PR with your changes in plugin.xml so others can benefit from your fix.

beard7 commented 5 years ago

Hi @iMicknl

I wouldn't call my changes a fix, as such, as it would break the plugin on Android platforms < 7. It's really just a case of changing the paths into which the resources are copied in plugin.xml:

<source-file src="src/android/lib/jni" target-dir="src/main/java/com/openalpr"/>
<source-file src="src/android/lib/util" target-dir="src/main/java/com/openalpr"/>
<source-file src="src/android/lib/armeabi-v7a" target-dir="jniLibs"/>

Either that or just manually move the files in the app folder to match the targer dir shown above after installing your plugin.

RZR666 commented 5 years ago

I seem to be having the same issue in Ionic 4.

`

 console.log("hit");

this.openalpr.scan(croppedImage.data, openAlprOptions).then((result: [OpenALPRResult]) => {

              console.log("not hit");

            })
            .catch(error => {

             console.log("not hit");
            });`
iMicknl commented 5 years ago

@RZR666 please create a new issue for your specific problem and have a look at our readme for the Ionic 4 setup.