Ask Your Question

telopena's profile - activity

2013-07-28 09:03:41 -0600 commented question keep the same aspect of preview with different resolutions

I solved my problem. I donwloaded the last version of Opencv and with this version I can see all the resolutions with the same aspect.

2013-07-23 11:42:01 -0600 asked a question keep the same aspect of preview with different resolutions

I am doing an Android application with opencv, and i want that when the user changes the resolution, the preview image keep the size. Any ideas?

this is my java class which controls camera:

package com.example.telo3;

import java.util.List;


import org.opencv.android.JavaCameraView;
import org.opencv.android.NativeCameraView;

import android.content.Context;
import android.hardware.Camera.Size;
import android.util.AttributeSet;
import android.util.Log;

public class ControlCamera extends JavaCameraView {


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

        mMaxWidth=176;
        mMaxHeight=144;
    }

    @SuppressWarnings("static-access")
    public int comprobar_camara() {

        return (mCamera.getNumberOfCameras());

    }

    public List<Size> getResolutionList() {
        return mCamera.getParameters().getSupportedPreviewSizes();
    }

    public void setResolution(Size resolution) {
        disconnectCamera();
        mMaxHeight = resolution.height;
        mMaxWidth = resolution.width;
        connectCamera(getWidth(), getHeight());

    }

    public Size getResolution() {
        return mCamera.getParameters().getPreviewSize();
    }

}

this my layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:opencv="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    tools:context=".MainActivity" >

    <com.example.telo3.ControlCamera
        android:id="@+id/tutorial5_activity_java_surface_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        opencv:camera_id="front"
        opencv:show_fps="true" />

    <com.example.telo3.ControlCamera
        android:id="@+id/tutorial5_activity_java_surface_view2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        opencv:camera_id="back"
        opencv:show_fps="true" />

</RelativeLayout>

thanks

2013-07-23 11:40:02 -0600 asked a question keep the same aspect of preview with different resolutions

I am doing an Android application with opencv, and i want that when the user changes the resolution, the preview image keep the size. Any ideas?

this is my java class which controls camera:

package com.example.telo3;

import java.util.List;


import org.opencv.android.JavaCameraView;
import org.opencv.android.NativeCameraView;

import android.content.Context;
import android.hardware.Camera.Size;
import android.util.AttributeSet;
import android.util.Log;

public class ControlCamera extends JavaCameraView {


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

        mMaxWidth=176;
        mMaxHeight=144;
    }

    @SuppressWarnings("static-access")
    public int comprobar_camara() {

        return (mCamera.getNumberOfCameras());

    }

    public List<Size> getResolutionList() {
        return mCamera.getParameters().getSupportedPreviewSizes();
    }

    public void setResolution(Size resolution) {
        disconnectCamera();
        mMaxHeight = resolution.height;
        mMaxWidth = resolution.width;
        connectCamera(getWidth(), getHeight());

    }

    public Size getResolution() {
        return mCamera.getParameters().getPreviewSize();
    }

}

this my layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:opencv="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    tools:context=".MainActivity" >

    <com.example.telo3.ControlCamera
        android:id="@+id/tutorial5_activity_java_surface_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        opencv:camera_id="front"
        opencv:show_fps="true" />

    <com.example.telo3.ControlCamera
        android:id="@+id/tutorial5_activity_java_surface_view2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        opencv:camera_id="back"
        opencv:show_fps="true" />

</RelativeLayout>

thanks

2013-07-16 03:27:43 -0600 received badge  Supporter (source)
2013-07-15 14:12:08 -0600 commented question How to Capture Camera frames with hidden/Dummy Surfaceview in Android

Hi CGN, could you solve the problem? And can you help me? Thanks

2013-07-15 13:51:19 -0600 commented answer How to Capture Camera frames with hidden/Dummy Surfaceview in Android

I have the same problem and i not understand very well. Your idea consists in creating a new class that has the same methods that NativeCameraView? Does it have extend CameraBridgeViewBase too? Thanks

2013-07-15 13:13:04 -0600 asked a question using javacameraview without views

I am doing an Android application and I use javacameraview in my activities. Now, I want implement a Service but how I can use javacameraview without using views? Because in a service I can not use UI. Some ideas?

Thanks

2013-05-27 09:37:43 -0600 asked a question Try catch with CameraBridgeViewBase

I am doing an Android application based in OpenCV. I have two elements of JavaCameraView in my main layout, one with id = frontal and the other with id= back. And my idea is load the frontal view and if it produces error load the back view. This is my code:

     try{
             mOpenCvCameraView.enableView();
            }

            catch(){
            Log.e(TAG,"fail frontal camera");
                //mOpenCvCameraView=mOpenCvCameraView2;
            //mOpenCvCameraView.enableView();
            }

What would be my exception to catch? Thanks