AndroidScannerDemo icon indicating copy to clipboard operation
AndroidScannerDemo copied to clipboard

Confused how to get nativ cpp code in my project

Open RozinaDarediya opened this issue 7 years ago • 1 comments

Hi @jhansireddy Thank you for awesome code. First of all its not an issue its my unawareness. I am a fresher in Android Development. And using your AndroidScannerDemo project to explore openCv. Your code is awesome But I want to add more color to set in Bitmap. As you have used nativ code( if I am not wrong). I am not able to add more functions like - ` public native Bitmap getScannedBitmap(Bitmap bitmap, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);

public native Bitmap getGrayBitmap(Bitmap bitmap);

public native Bitmap getMagicColorBitmap(Bitmap bitmap);

public native Bitmap getBWBitmap(Bitmap bitmap);

public native float[] getPoints(Bitmap bitmap);`

Please guide me how to access these functions so I can make more similar functionality.

And also I am not able to use functions from openCV sdk like Mat Described in the - http://www.discoversdk.com/blog/opencv-with-android-studio Like - `Bitmap img = BitmapFactory.decodeResource(getResources(),R.drawable.pen); Mat source = new Mat(); Mat dest = new Mat(); Utils. bitmapToMat( img, source);

Imgproc. cvtColor(source, dest, Imgproc.COLOR_RGB2GRAY); Bitmap btmp = Bitmap.createBitmap(dest.width(),dest.height(),Bitmap.Config.ARGB_8888); Utils. matToBitmap(dest,btmp); imageView1. setImageBitmap (btmp);`

Please correct me if I am going wrong any where. Please guide me for this. Thank you Hope I will heard very soon from you. Sorry if you find difficult to understand my question as I am very confused. Thanks

RozinaDarediya avatar Dec 22 '17 13:12 RozinaDarediya

@jhansireddy
I am successfully able to build the project. But i am really confused how to change colours in cvtColor(mbgra, dst, CV_BGR2GRAY); if i am changing it to CV_GRAY2BGR565 it gives error as below OpenCV Error: Assertion failed (scn == 3 || scn == 4) in void cv::cvtColor(cv::InputArray, cv::OutputArray, int, int)

It will be very helpful if you give me any hint or link to solve my this question.

Thank you If anyone has the answer please answer.

RozinaDarediya avatar Dec 28 '17 10:12 RozinaDarediya