Ask Your Question

atasoyh's profile - activity

2014-02-28 07:12:20 -0600 received badge  Nice Question (source)
2013-06-20 01:49:50 -0600 asked a question Why does the image break when converted to byte[]? (takePicture with Opencv on Android)

I have an project that used Camera and Opencv. I take picture and crop image with OpenCv. After I have a Mat file to convert Jpeg for send byte[] data to Activity.

Mat to Bitmap

bmp2 = Bitmap.createBitmap(checkFrame.cols(),checkFrame.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(checkFrame, bmp2, true);
checkFrame.release();

Bitmap to byte[]

ByteArrayOutputStream stream2 = new ByteArrayOutputStream();
bmp2.compress(Bitmap.CompressFormat.JPEG, 0,stream2);
bmp2.recycle();
bmp2 = null;
byte[] byteArray2 = stream2.toByteArray();

On Activity ,

((ImageView) findViewById(R.id.photoView))
                                .setImageBitmap(BitmapFactory
                                        .decodeByteArray(photo2, 0,
                                                photo2.length));

But this image is not same with I cropped. This is like 16bit color... If I direct send Bitmap to activity and set ImageBitmap, this is good. Why does the image break when it's converted to byte[]?

2013-05-28 09:24:05 -0600 answered a question Set a specific resolution on the tutorial-3-CameraControl in OpenCV4Android SDK
public int getWidth(Object obj) {
        Camera.Size size = (Camera.Size) obj;
        return 320;
    }

    public int getHeight(Object obj) {
        Camera.Size size = (Camera.Size) obj;
        return 240;
    }

If your app get sizes using these methods, they are staticly return values.

2013-05-24 01:26:36 -0600 answered a question how can I build and use only highgui-imgproc-core modules on Android?

I solved my problem.

First you need download source code from here. After you delete codes that not need from modules and those used include folders files. After build with /Android/scripts...

2013-05-24 01:19:36 -0600 asked a question Manually set buffer was too small! Android Camera takePicture is using Previews small buffer

I am developing a project using OPENCV. I have some process on onCameraFrame. While it shows previews, user can take a photo. But in some devices, I take an error after called takePicture(...) method. I set manually picture and preview sizes, picture is bigger than preview. What should I do?

E/Camera-JNI(11783): Manually set buffer was too small! Expected 539380 bytes, but got 460800!

This buffer's size is my frame size, 460800. I logged frame size at onCameraFrame . Every frame's sizes are 460800. As far as I understand, takePicture tries to use previews buffer. And theirs sizes are different.

2013-05-16 08:17:53 -0600 received badge  Self-Learner (source)
2013-05-16 01:46:10 -0600 answered a question static initialization And multipleAPK without Jni code

I decided to use empty jni that defines arm for filtering.

2013-04-24 01:52:08 -0600 commented answer Reducing Android package

OpenCV Manager cant be answer for this question. Anyway to lower libopencv_java.so's file size? I think, this file has all modules.

2013-04-24 01:49:51 -0600 received badge  Supporter (source)
2013-04-22 06:10:05 -0600 received badge  Student (source)
2013-04-22 05:50:41 -0600 asked a question static initialization And multipleAPK without Jni code

I use Opencv with Android Library Project SDK. I need create multiple-apk each CPU. But My code has no JNI part.(no Apllication.mk) And i can't filter CPU on AndroidManifest. How should I do?

CPU architecture (ABI)
This is based on the native libraries included in each APK (which are determined by the architectures you declare in the Application.mk file) when using the Android NDK.
2013-04-22 05:43:21 -0600 asked a question how can I build and use only highgui-imgproc-core modules on Android?

Hi, I use opencv library with static initialization. So SDK uploads every modules in APK. and Apk size is min 13 mb for one CPU type. But I use only three module from opencv. How can I crop library?? is it possible?

2013-04-04 03:32:22 -0600 commented question OpenCVManager couldn't built

@Andrey I edited my message.

2013-04-02 07:49:57 -0600 received badge  Editor (source)
2013-04-02 06:59:40 -0600 asked a question OpenCVManager couldn't built

Hi, I need to use opencv library thats includes what opensvmanager does. I am newbea at NDK and OpenCv. Which steps should I follow??

-------------UPDATED----------

I learnt after research, I thought that manager sense CPU version and dowload its .so package. And use it with a interface. BUT there are alot of APK for every CPUs :) and playstore filters them.:)

I decided publish more than one APK.

----irrelevant ----- I can't build OpenCVEngine. when I want to build .cpp codes with ndk-build

mobdevs-MacBook-Pro-2:engine hatasoy$ ndk-build
Compile++ thumb  : OpenCVEngine <= OpenCVEngine.cpp
In file included from jni/BinderComponent/OpenCVEngine.h:5,
             from jni/BinderComponent/OpenCVEngine.cpp:2:
jni/include/IOpenCVEngine.h:4:31: error: binder/IInterface.h: No such file or directory
jni/include/IOpenCVEngine.h:5:27: error: binder/Parcel.h: No such file or directory
jni/include/IOpenCVEngine.h:6:28: error: utils/String16.h: No such file or directory
In file included from jni/BinderComponent/OpenCVEngine.cpp:2:
jni/BinderComponent/OpenCVEngine.h:10:27: error: utils/String8.h: No such file or directory
jni/BinderComponent/OpenCVEngine.cpp:5:23: error: utils/Log.h: No such file or directory
In file included from jni/BinderComponent/OpenCVEngine.h:5,
             from jni/BinderComponent/OpenCVEngine.cpp:2:
jni/include/IOpenCVEngine.h:17: error: 'android' is not a namespace-name
jni/include/IOpenCVEngine.h:17: error: expected namespace-name before ';' token
jni/include/IOpenCVEngine.h:19: error: 'android' has not been declared
jni/include/IOpenCVEngine.h:19: error: expected '{' before 'IInterface'
jni/include/IOpenCVEngine.h:20: error: invalid type in declaration before '{' token
jni/include/IOpenCVEngine.h:20: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
jni/include/IOpenCVEngine.h:21: error: expected primary-expression before 'public'
jni/include/IOpenCVEngine.h:21: error: expected '}' before 'public'
jni/include/IOpenCVEngine.h:21: error: expected ',' or ';' before 'public'
jni/include/IOpenCVEngine.h:27: error: 'android' has not been declared
jni/include/IOpenCVEngine.h:27: error: expected initializer before 'GetLibPathByVersion'
jni/include/IOpenCVEngine.h:28: error: 'android' has not been declared
jni/include/IOpenCVEngine.h:28: error: expected initializer before 'GetLibraryList'
jni/include/IOpenCVEngine.h:29: error: 'virtual' outside class declaration
jni/include/IOpenCVEngine.h:29: error: 'android' has not been declared
jni/include/IOpenCVEngine.h:29: error: expected ',' or ';' before '=' token
jni/include/IOpenCVEngine.h:30: error: expected declaration before '}' token
make: *** [obj/local/armeabi/objs/OpenCVEngine/BinderComponent/OpenCVEngine.o] Error 1