Ask Your Question

Poovamraj's profile - activity

2017-11-15 09:38:45 -0500 received badge  Notable Question (source)
2017-07-07 01:58:48 -0500 received badge  Student (source)
2017-04-06 09:19:39 -0500 received badge  Popular Question (source)
2016-02-04 11:10:25 -0500 received badge  Self-Learner (source)
2016-02-04 06:53:12 -0500 received badge  Scholar (source)
2016-02-04 06:53:01 -0500 answered a question Whenever i use Imgproc.rectangle and Imgproc.circle function following error appears

Actually I found the answer. The problem is with importing the library. Even if we dont use the native files we have to copy it to the src folder of the project it seems. For a detailed answer please refer this link

http://stackoverflow.com/questions/11...

2016-02-03 07:51:40 -0500 received badge  Editor (source)
2016-02-03 07:40:18 -0500 commented question Whenever i use Imgproc.rectangle and Imgproc.circle function following error appears

I tried them both and both the time the error is same.

2016-02-02 11:01:18 -0500 commented question Whenever i use Imgproc.rectangle and Imgproc.circle function following error appears

Is it possible that my library does not have the implementation of Rect ?

2016-02-02 09:51:49 -0500 commented question Whenever i use Imgproc.rectangle and Imgproc.circle function following error appears

yes i have declared a Scalar value for it Scalar CONTOUR_COLOR = new Scalar(255, 0, 0, 255); however i try the rectangle there is same error saying no implementation found

2016-02-01 12:09:39 -0500 asked a question Whenever i use Imgproc.rectangle and Imgproc.circle function following error appears

package org.opencv.samples.tutorial1;

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.*; //import org.opencv.highgui.Highgui; import org.opencv.imgproc.Imgproc;

import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceView; import android.view.View; import android.view.View.OnTouchListener; import android.view.WindowManager;

import com.example.imgloader.R;

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

public class Tutorial1Activity extends Activity implements CvCameraViewListener2 {

private static final String TAG = "OCVSample::Activity";
private Mat mRgba;
private Mat mGray;

private CameraBridgeViewBase mOpenCvCameraView;
Scalar min = new Scalar(0, 30, 60, 0);
Scalar max = new Scalar(20, 150, 255, 0);
Mat pointMatHsv;
Mat heirarchy;
Mat overlay;

private static double mMinContourArea = 0.1;
Mat hullMat;


Scalar CONTOUR_COLOR = new Scalar(255, 0, 0, 255);


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

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

public Tutorial1Activity() {
    Log.i(TAG, "Instantiated new " + this.getClass());
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "called onCreate");
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    setContentView(R.layout.tutorial1_surface_view);

    mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial1_activity_java_surface_view);
    mOpenCvCameraView.setMaxFrameSize(720, 480);

    mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);

    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();
}


public void onCameraViewStarted(int width, int height) {
    mGray = new Mat();
    mRgba = new Mat();
    pointMatHsv = new Mat(1, 1, CvType.CV_8UC3);
    heirarchy = new Mat();
    overlay = new Mat(1,1, CvType.CV_8UC3);




}

public void onCameraViewStopped() {
}

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    mRgba = inputFrame.rgba();
    mRgba.copyTo(pointMatHsv);

    Scalar CONTOUR_COLOR = new Scalar(255, 0, 0, 255);
    Imgproc.cvtColor(pointMatHsv, mGray, Imgproc.COLOR_RGB2HSV);
    Core.inRange(mGray, min, max, pointMatHsv);
    Imgproc.dilate(pointMatHsv, pointMatHsv, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));
    //Imgproc.dilate(mRgba, mRgba, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));
    Imgproc.erode(pointMatHsv, pointMatHsv, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));




    mGray = retContours(pointMatHsv,mRgba);

    return mRgba;
}

public Mat retContours(Mat pointMatHsv, Mat mRgba) {
    List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
    List<MatOfPoint> mContours = new ArrayList<MatOfPoint>();
    Imgproc.findContours(pointMatHsv, contours, heirarchy, Imgproc.RETR_TREE, Imgproc.CHAIN_APPROX_SIMPLE);

    double maxArea = 0;
    Iterator<MatOfPoint> each = contours.iterator();
    while (each.hasNext()) {
        MatOfPoint wrapper = each.next();
        double area = Imgproc.contourArea(wrapper);
        if (area > maxArea)
            maxArea = area;
    }
   // Imgproc.cvtColor(pointMatHsv,pointMatHsv,Imgproc.COLOR_HSV2RGB_FULL);

    mContours.clear();
    each = contours.iterator();
    while (each.hasNext()) {
        MatOfPoint contour = each.next();
        if (Imgproc.contourArea(contour) > mMinContourArea * maxArea) {
           // Core.multiply(contour, new Scalar(4, 4), contour);
            mContours.add(contour);

        }
    }
    Imgproc.drawContours(mRgba,mContours,-1,new Scalar(0, 255, 0));

    for(int i=0;i<mContours.size();i++) {
        MatOfPoint currentContour = mContours.get(i);
        drawConvexHull(currentContour);
        drawBoundingBox(currentContour);
        drawEnclosingCircle(currentContour);

    }





   return mRgba ...
(more)
2016-02-01 09:15:22 -0500 received badge  Enthusiast
2016-01-27 08:16:44 -0500 asked a question The program executes but the contours are not drawn

package org.opencv.samples.tutorial1;

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.*; import org.opencv.highgui.Highgui; import org.opencv.imgproc.Imgproc;

import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceView; import android.view.View; import android.view.View.OnTouchListener; import android.view.WindowManager;

import com.example.imgloader.R;

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

public class Tutorial1Activity extends Activity implements CvCameraViewListener2 {

private static final String TAG = "OCVSample::Activity";
private Mat mRgba;
private Mat mGray;
private Mat fin;
private CameraBridgeViewBase mOpenCvCameraView;
Scalar min=new Scalar(0,30,60,0);
Scalar max=new Scalar(20,150,255,0);
Mat pointMatHsv;
Mat heirarchy;

Scalar CONTOUR_COLOR = new Scalar(255,0,0);

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

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

public Tutorial1Activity() {
    Log.i(TAG, "Instantiated new " + this.getClass());
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "called onCreate");
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    setContentView(R.layout.tutorial1_surface_view);

    mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial1_activity_java_surface_view);
    mOpenCvCameraView.setMaxFrameSize(720, 480);

    mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);

    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();
}


public void onCameraViewStarted(int width, int height) {
    mGray = new Mat();
    mRgba = new Mat();
    pointMatHsv = new Mat(1, 1, CvType.CV_8UC3);
    heirarchy=new Mat();




}

public void onCameraViewStopped() {
}

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    mRgba = inputFrame.rgba();

    List<MatOfPoint> contours =new ArrayList<MatOfPoint>();
    List<MatOfInt> hull = new ArrayList<MatOfInt>();
    Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGB2HSV);
    Core.inRange(mGray, min, max, mRgba);
    Imgproc.dilate(mRgba, mRgba, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));
    //Imgproc.dilate(mRgba, mRgba, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));
    Imgproc.erode(mRgba, mRgba, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));




    mRgba.copyTo(pointMatHsv);
    contours=retContours(pointMatHsv);



    Imgproc.drawContours(pointMatHsv,contours,-1,CONTOUR_COLOR);
    return mRgba;
}
public List<MatOfPoint> retContours(Mat pointMatHsv)
{
    List<MatOfPoint> contours =new ArrayList<MatOfPoint>();
    Imgproc.findContours(pointMatHsv, contours, heirarchy, Imgproc.RETR_TREE, Imgproc.CHAIN_APPROX_NONE);
    return contours;
}

}

the program executes perfectly but the contours are not drawn in the image. please help

2016-01-24 00:35:53 -0500 asked a question Android:Cannot draw contours

package org.opencv.samples.tutorial1;

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.*; //import org.opencv.highgui.Highgui; import org.opencv.imgproc.Imgproc;

import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceView; import android.view.View; import android.view.View.OnTouchListener; import android.view.WindowManager;

import com.example.imgloader.R;

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

public class Tutorial1Activity extends Activity implements CvCameraViewListener2 {

private static final String TAG = "OCVSample::Activity";
private Mat mRgba;
private Mat mGray;
private CameraBridgeViewBase mOpenCvCameraView;
Scalar min=new Scalar(0,30,60,0);
Scalar max=new Scalar(20,150,255,0);

// Size three=new Size(3,3); //Size eight=new Size(8,8); //Mat erodeElement= Imgproc.getStructuringElement(Imgproc.MORPH_RECT,three); //Mat dilateElement=Imgproc.getStructuringElement(Imgproc.MORPH_RECT,eight);

 Mat hierarchy=new Mat();

Scalar CONTOUR_COLOR = new Scalar(255,0,0,255);

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

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

public Tutorial1Activity() {
    Log.i(TAG, "Instantiated new " + this.getClass());
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "called onCreate");
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    setContentView(R.layout.tutorial1_surface_view);

    mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial1_activity_java_surface_view);

    mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);

    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();
}


public void onCameraViewStarted(int width, int height) {
    mGray = new Mat();
    mRgba = new Mat();



}

public void onCameraViewStopped() {
}

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    mRgba = inputFrame.rgba();
   List<MatOfPoint> contours =new ArrayList<MatOfPoint>();
    Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGB2HSV);
    Core.inRange(mGray, min, max, mRgba);
//  Imgproc.erode(mRgba, mGray, new Mat());
  //  Imgproc.dilate(mGray,mRgba, new Mat());

   Imgproc.findContours(mRgba,contours,hierarchy,Imgproc.RETR_EXTERNAL,Imgproc.CHAIN_APPROX_SIMPLE);





    //     Minimum size allowed for consideration
    for(int idx=0;idx<contours.size();idx++)

      Imgproc.drawContours(mRgba,contours,idx,CONTOUR_COLOR);





    return mRgba;
}

}

This is my code but whenever I run it I get the following errors in the logcat NOTE: I tried this code by seeing the sample codes

01-24 01:27:39.089 7697-7697/org.opencv.samples.tutorial1 I/art﹕ Late-enabling -Xcheck:jni 01-24 01:27:39.114 7697-7707/org.opencv.samples.tutorial1 I/art﹕ Debugger is no longer active 01-24 01:27:39.226 7697-7697/org.opencv.samples.tutorial1 I/LoadedApk﹕ No resource references to update in package common 01-24 01:27:39.226 7697-7697/org.opencv.samples.tutorial1 I/LoadedApk﹕ No resource references to update in package com.cyngn.hexo 01-24 01:27:39.229 7697-7697/org.opencv.samples.tutorial1 E/art﹕ No implementation found for long org.opencv.core.Mat.n_Mat() (tried Java_org_opencv_core_Mat_n_1Mat and Java_org_opencv_core_Mat_n_1Mat__) 01-24 01:27:39.230 7697-7697 ... (more)