Ask Your Question

prabhakar's profile - activity

2020-12-08 07:47:54 -0500 received badge  Student (source)
2015-06-24 23:42:01 -0500 commented question find the edge of image with the help of axis(x,y) in opencv in android

@berak, it may be, I use wrong concept. Actually i want to implement, when i touch the object in image i want to get the edges of the object. for full description http://stackoverflow.com/questions/30...

2015-06-24 06:35:14 -0500 commented question How to get boundary of region ?

when i use controus() method i need Mat object as input and output a/c to documentation. when i touch the object or region how to store that object in Mat form.

2015-06-24 05:15:55 -0500 asked a question How to get boundary of region ?

I am working on paint application facing problem when i touch the object or wall, how can i get the region or boundary of wall or object. Because when i touch the object i have to apply the canny() method for edge detection. I am new in opencv with android so help me guys..

2015-06-22 02:07:17 -0500 asked a question Color changing the object in Android application

Basically my goal is change the color of object in real time for paint application. To achieve this goal i follow the following concepts 1. i use the canny() metod for finding the object. 2. Using contorous for edge detection. 3. using flodfill() for coloring thr object.

If there is any other concept require to achieve the goal please suggest me.

I have tried but not getting exact

controus edge. original input

original image

image description

my code is here:

package com.example.imageprocess;

import java.util.ArrayList;
import java.util.List;

import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.CameraBridgeViewBase;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;

public class MainActivity extends Activity implements CvCameraViewListener2{


        private Mat                    mRgba;
        private Mat                    mIntermediateMat;
        private Mat                    mGray;

        private CameraBridgeViewBase   mOpenCvCameraView;

        private BaseLoaderCallback  mLoaderCallback = new BaseLoaderCallback(this) {
            @Override
            public void onManagerConnected(int status) {
                switch (status) {
                    case LoaderCallbackInterface.SUCCESS:
                    {
                        Log.i("OPENCVACTIVITY", "OpenCV loaded successfully");

                        // Load native library after(!) OpenCV initialization
                       // System.loadLibrary("mixed_sample");

                        mOpenCvCameraView.enableView();
                    } break;
                    default:
                    {
                        super.onManagerConnected(status);
                    } break;
                }
            }
        };

       /* public MainActivity() {
            Log.i("OPENCVACTIVITY", "Instantiated new " + this.getClass());
        }
*/
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
          getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

            setContentView(R.layout.activity_main);

            mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view);
            mOpenCvCameraView.setCvCameraViewListener(this);
    }



    @Override
    public void onPause()
    {
        super.onPause();
        if (mOpenCvCameraView != null)
            mOpenCvCameraView.disableView();
    }

    @Override
    public void onResume()
    {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
    }

    public void onDestroy() {
        super.onDestroy();
        if (mOpenCvCameraView != null)
            mOpenCvCameraView.disableView();
    }

    @Override
    public void onCameraViewStarted(int width, int height) {
        // TODO Auto-generated method stub
         mRgba = new Mat(height, width, CvType.CV_8UC4);
            mIntermediateMat = new Mat(height, width, CvType.CV_8UC4);
            mGray = new Mat(height, width, CvType.CV_8UC1);

    }

    @Override
    public void onCameraViewStopped() {
         mRgba.release();
            mGray.release();
            mIntermediateMat.release();

    }

    @Override
    public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
        Mat gaussian_output = new Mat();
         mRgba = inputFrame.rgba();
         Imgproc.Canny(inputFrame.gray(), mIntermediateMat, 80, 100);
         Imgproc.cvtColor(mIntermediateMat, mRgba, Imgproc.COLOR_GRAY2RGBA, 4);
         Imgproc.GaussianBlur(mIntermediateMat, gaussian_output, new Size(5, 5), 5);

         List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
         Log.i("CONTROUS", "Contours");
         Mat gray = new Mat(gaussian_output.size(),CvType.CV_8UC1);
         Imgproc.findContours(gray, contours, new Mat(), Imgproc.RETR_LIST,
                 Imgproc.CHAIN_APPROX_SIMPLE);
         Imgproc.drawContours(gray, contours,1, new Scalar(0,255,0));
         Log.i("Controus done","Contours done");

         //if no contours are detected
         if(contours.size() == 0){
             Log.i("Controus","contour size is 0");
         }
            // return ;

         /// Find contours
         //findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
        return mRgba;
    }


}
2015-06-22 01:14:09 -0500 received badge  Enthusiast
2015-06-20 01:43:58 -0500 commented question how to paint the wall on real time image?

can u suggest me any link or sample code

2015-06-20 00:39:38 -0500 asked a question color change in image for android application.

I want to implement an application for color change feature for my paint application. I use opencv library and I have to do all this on real time image (camera image). Below the my original and expected output

Original Image

image description

2015-06-19 02:42:09 -0500 commented question find the edge of image with the help of axis(x,y) in opencv in android

@StevenPuttemans now i have improve my question

2015-06-19 02:41:12 -0500 received badge  Editor (source)
2015-06-18 06:23:48 -0500 asked a question find the edge of image with the help of axis(x,y) in opencv in android

I have to color the object when it touched. For that follow the some basic concepts: I am getting coordinates of that portion where object is touched. After that I have to find the edges of touched object. Then fill color of that object. here I get the coordinates of touched portion.

int cols = mRgba.cols();
int rows = mRgba.rows();

int xOffset = (mOpenCvCameraView.getWidth() - cols) / 2;
int yOffset = (mOpenCvCameraView.getHeight() - rows) / 2;

int x = (int)event.getX() - xOffset;
int y = (int)event.getY() - yOffset;

x,y shows the coordinates of the touched portion but problem is to find the corners of object. For corners i use canny() method of opencv But no idea how to implement it by coding in opencv in android.

2015-06-17 03:59:48 -0500 asked a question how to paint the wall on real time image?

I want to visualize the image on real time. I mean to change the color of wall on camera image (real time).For this I use opencv and for finding the object use canny algo. How to change the color of object . Any idea, Please help.

Thanks in advance..