Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to detect corners in frames retrieved from Camera

I am working with OpenCV4Android version 2.4.11, and I am trying to detect cornrs in frames retrieved from the camera. i used "cornerHarris" method to detect the corners as shown in the code below. the problem is, at run time the Mat "corner" is completely black.

please let me know why the Mat that contains the corners is balck and how to solve this problem

code:

Mat mMatGray = new Mat();
Imgproc.cvtColor(mMatInputFrame, mMatGray, Imgproc.COLOR_BGR2GRAY);

corners = new Mat(mMatInputFrame.size(), CvType.CV_32FC1, Scalar.all(0));
Imgproc.cornerHarris(mMatGray,corners,1,3,3,1);

corners.convertTo(corners, CV_8UC(4) );

final Bitmap bitmap = Bitmap.createBitmap(mMatInputFrame.cols(), mMatInputFrame.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(corners, bitmap);
getActivity().runOnUiThread(new Runnable() {
    @Override
    public void run() {
        mIVEdges.setImageBitmap(bitmap);
    }
});

how to detect corners in frames retrieved from Camera

I am working with OpenCV4Android version 2.4.11, and I am trying to detect cornrs in frames retrieved from the camera. i used "cornerHarris" method to detect the corners as shown in the code below. the problem is, at run time the Mat object that is named "corner" is completely black.

please let me know why the Mat that contains the corners is balck and how to solve this problem

code:

Mat mMatGray = new Mat();
Imgproc.cvtColor(mMatInputFrame, mMatGray, Imgproc.COLOR_BGR2GRAY);

corners = new Mat(mMatInputFrame.size(), CvType.CV_32FC1, Scalar.all(0));
Imgproc.cornerHarris(mMatGray,corners,1,3,3,1);

corners.convertTo(corners, CV_8UC(4) );

final Bitmap bitmap = Bitmap.createBitmap(mMatInputFrame.cols(), mMatInputFrame.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(corners, bitmap);
getActivity().runOnUiThread(new Runnable() {
    @Override
    public void run() {
        mIVEdges.setImageBitmap(bitmap);
    }
});