Ask Your Question

MoHaKa's profile - activity

2019-01-13 23:59:32 -0600 received badge  Notable Question (source)
2016-05-22 08:43:13 -0600 received badge  Popular Question (source)
2013-02-13 11:24:29 -0600 commented answer Loading OpenCV on android fail sometimes

in the ticket Kirill Kornyakov says that my exception has been solved, could you tell me how can i get the solved copy of open cv please?

2013-02-05 10:29:42 -0600 commented answer Loading OpenCV on android fail sometimes

i have updated the ticket, but i wanna ask you: is this problem in my code or it is bug in opencv?

2013-02-05 09:46:47 -0600 commented answer Loading OpenCV on android fail sometimes

OK, i will edit my question

2013-02-04 11:41:07 -0600 received badge  Student (source)
2013-02-04 11:06:07 -0600 asked a question Loading OpenCV on android fail sometimes

hello, i am working on android app using open cv library, so i have to load open cv on (onResume) of my activity:

try {
    if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, con, new LoaderCallbackInterface() {
            @Override
            public void onPackageInstall(int operation, InstallCallbackInterface callback) {
            }

            @Override
            public void onManagerConnected(int status) {

            }
            })) {
        Toast.makeText(con, "cannot connect to opencv ", Toast.LENGTH_SHORT).show();
    }
} catch (Exception e) {
    e.printStackTrace();
    Log.e("Utilities", "can not load opencv, an exception has been thrown while.");
}

now my problem is sometimes and with unspecific conditions the open cv load fail and give me this LogCat:

V/Main(7042): OnCreate
V/Main(7042): onResume
D/OpenCVManager/Helper(7042): Service connection created
D/OpenCVManager/Helper(7042): Trying to get library path
W/System.err(7042): android.os.DeadObjectException
W/System.err(7042): at android.os.BinderProxy.transact(Native Method)
W/System.err(7042): at org.opencv.engine.OpenCVEngineInterface$Stub$Proxy.getLibPathByVersion(OpenCVEngineInterface.java:137)
W/System.err(7042): at org.opencv.android.AsyncServiceHelper$1.onServiceConnected(AsyncServiceHelper.java:182)
W/System.err(7042): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1097)
W/System.err(7042): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1114)
W/System.err(7042): at android.os.Handler.handleCallback(Handler.java:615)
W/System.err(7042): at android.os.Handler.dispatchMessage(Handler.java:92)
W/System.err(7042): at android.os.Looper.loop(Looper.java:137)
W/System.err(7042): at android.app.ActivityThread.main(ActivityThread.java:4898)
W/System.err(7042): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(7042): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err(7042): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
W/System.err(7042): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
W/System.err(7042): at dalvik.system.NativeStart.main(Native Method)
D/OpenCVManager/Helper(7042): Init finished with status 255
D/OpenCVManager/Helper(7042): Unbind from service
D/OpenCVManager/Helper(7042): Calling using callback
E/OpenCVLoader/BaseLoaderCallback(7042): OpenCV loading failed!
D/AndroidRuntime(7042): Shutting down VM
W/dalvikvm(7042): threadid=1: thread exiting with uncaught exception (group=0x420b32a0)

so what is this problem and why "OpenCV loading failed!" and how to solve it? Please answer me as soon as possible :)

2013-01-18 17:15:44 -0600 commented answer Mat object returns invalid results.

in galaxy the resolution is 960 720 but on transformer 704 576 Is this the correct resolution to get valid image??

2013-01-18 10:19:04 -0600 received badge  Editor (source)
2013-01-18 10:14:52 -0600 asked a question Mat object returns invalid results.

i have tow android devices the first is asus transformer tf101 and the other is Samsung galaxy note

now, my problem is in generating images from android camera preview. this is my java code:

public void onPreviewFrame(byte[] data, Camera camera) {
    File test = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "/myImg.jpg");

    Mat mYuv = new Mat(previewSize.height + (previewSize.height / 2), previewSize.width, CvType.CV_8UC1);
    Mat mRgba = new Mat(previewSize.height, previewSize.width, CvType.CV_8UC1);
    mYuv.put(0, 0, data);
    Imgproc.cvtColor(mYuv, mRgba, Imgproc.COLOR_YUV2BGR_NV12);
    Highgui.imwrite(test.getPath(), mRgba);
}

on galaxy: mRgba returns fine image, but on transformer the result is green image:

image description

what should i do to generate valid image on transformer??

if my question is not clear please comment me

2013-01-17 06:57:52 -0600 commented answer camera preview gives gray images

yes i have tried it and it worked, anyway thank you for answer!

2013-01-17 06:32:31 -0600 commented answer camera preview gives gray images

in java, mat contractor dosent contain byte[], so you cant put image data in contractor directly.

2013-01-17 06:29:55 -0600 received badge  Scholar (source)
2013-01-17 06:16:50 -0600 commented answer camera preview gives gray images

thank you alot your link helped me :)

2013-01-17 03:51:12 -0600 asked a question camera preview gives gray images

hi, i am developing android app using android sdk camera. on camera preview i need the frame content so i am using PreviewCallback to return the data in byte array, now my problem is saving the data in mat object the mat return gray images:

public void onPreviewFrame(byte[] data, Camera camera) {
    Mat src = new Mat(previewSize.height, previewSize.width, CvType.CV_8U, new Scalar(255));
    src.put(0, 0, data);
    Highgui.imwrite("/mnt/sdcard/1.jpg", src);
}

anybody can help me to generate argb images

note: i am using NV21 in preview image format.

2013-01-17 03:29:10 -0600 received badge  Supporter (source)