Ask Your Question

Marde's profile - activity

2019-04-09 03:19:30 -0500 received badge  Popular Question (source)
2014-02-03 09:21:05 -0500 asked a question How to draw lines on OpenCV Camera Preview?

Im using OpenCV camera preview.

I want to draw a rectangle over the live preview. Ive tried to override the ondraw method, but I cant see a line. Please help.


import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;

public class CustomOpenCVJavaCameraView extends JavaCameraView {

    public CustomOpenCVJavaCameraView(Context context, AttributeSet attrs) {
        super(context, attrs);

    private Paint linePaint;
    protected void init() { 
        Resources r = this.getResources();
        linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        linePaint.setShadowLayer(2, 1, 1, r.getColor(R.color.shadow_color));        

      protected void onDraw(Canvas canvas) {
2013-05-15 06:30:10 -0500 commented answer OpenCV android camera preview with custom layout?

Ok thanks. I keep it in mind if I need it again. Its just I thought about how to get an ad banner to an opencv view. But it seems those Ad banner could just be overlayed.

2013-05-15 06:11:51 -0500 received badge  Supporter (source)
2013-05-15 06:09:58 -0500 commented answer JavaCameraView terrible on OpenCV above 2.4.3

Thank you very much for your answer. Its a good idea, and Im glad anyone answering. But unfortunately its not the solution. I testet it in both versions and even with the lowest resolution possible its still terrible with version 2.4.5. With 2.4.3. theres no problem even with higher resolution.

So it must be something else. I really hope the developers will fix this.

2013-05-15 02:08:05 -0500 asked a question JavaCameraView terrible on OpenCV above 2.4.3

I already asked that question, but without response. So Im gonna ask again and make the problem clearer this time, so everybody should be able to reproduce it.

If Im running "OpenCV Tutorial 5 - CameraControl" which can be found in the samples from the OpenCV 2.4.3 release everything is fine, that means, the JavaCameraPreview is smooth and looks as good as the NativeCameraView or the standard app camera preview that comes with my phone to take pictures.

But if Im now running "OpenCV Tutorial 3 - CameraControl" which can be found in the samples from the OpenCV 2.4.5 release, the CameraPreview now looks horrible. Its slow and blury and it stutters and it hurts to see it.

I dont want to start speculating what could be going wrong, because I really dont know it. But it should be possible for some of you to tell me if your having the same problen with it.

Maybe its a bug and it would be a good idea if some developer realize that problem if they already didn't.

2013-05-15 01:51:40 -0500 received badge  Editor (source)
2013-05-08 19:41:01 -0500 asked a question OpenCV android camera preview with custom layout?

I want to add a button to the opencvcamera preview, but the button isnt visible and the Preview still fills the whole screen. Is there a way to make a custom layout where the OpenCV camera preview does not fill the whole scrren to display an additional button?

 <LinearLayout  xmlns:android=""


            opencv:camera_id="any" />

        android:text=" * Take Picture " 

     </LinearLayout >
2013-05-08 18:17:44 -0500 asked a question opencv 2.4.4 slow Java Camera on Android (bug)?

Im using OpenCV on my Xperia Mini St15i Android device. With version 2.4.3 theres no difference between using NativeCameraView and JavaCameraView in the camera preview. But with version 2.4.4 and 2.4.5 JavaCameraView is now really slow and blury in comparison to NativeCameraView, regardless if Im using CvCameraViewListener or CvCameraViewListener2.

Could it be this is a bug?

Anyway can I use the NativeCameraView like a normal JavaCameraPreview with setting autofocus callback, setting camera parameters and all that stuff? And if so wheres the difference between Java and Native camera?