Ask Your Question

n8bar's profile - activity

2016-03-09 16:52:23 -0600 commented question getSupportedPreviewSizes() broken in java?

I get: Cannot resolve method 'CameraBridgeViewBase.getSupportedPreviewSizes()' from Android Studio IDE even before building the project. Where did it go?

2016-01-13 17:27:40 -0600 asked a question compareHist problem, type != CV_32F

I'm trying to compare card bitmaps in an android application.

The error I'm getting is:

OpenCV Error: Assertion failed (H1.type() == H2.type() && H1.type() == CV_32F) in double cv::compareHist(cv::InputArray, cv::InputArray, int), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/imgproc/src/histogram.cpp, line 1985

Converting the Mat's to CV_32F doesn't seem to fix the problem.

Here is my code:

    String[] cardFileName= {
            "c2.jpg","c3.jpg","c4.jpg","c5.jpg","c6.jpg","c7.jpg","c8.jpg","c9.jpg","c10.jpg","cJ.jpg","cQ.jpg","cK.jpg","cA.jpg",
            "d2.jpg","d3.jpg","d4.jpg","d5.jpg","d6.jpg","d7.jpg","d8.jpg","d9.jpg","d10.jpg","dJ.jpg","dQ.jpg","dK.jpg","dA.jpg",
            "h2.jpg","h3.jpg","h4.jpg","h5.jpg","h6.jpg","h7.jpg","h8.jpg","h9.jpg","h10.jpg","hJ.jpg","hQ.jpg","hK.jpg","hA.jpg",
            "s2.jpg","s3.jpg","s4.jpg","s5.jpg","s6.jpg","s7.jpg","s8.jpg","s9.jpg","s10.jpg","sJ.jpg","sQ.jpg","sK.jpg","sA.jpg"
    };

    int[] cardValue = {
            2,3,4,5,6,7,8,9,10,11,12,13,1,
            2,3,4,5,6,7,8,9,10,11,12,13,1,
            2,3,4,5,6,7,8,9,10,11,12,13,1,
            2,3,4,5,6,7,8,9,10,11,12,13,1
    };

    double[] comparisonResults={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};


public Bitmap checkCardBitmap;
public int DetectCardValue(Bitmap cardBitmap) {

    for(int cardIndex=0; cardIndex < 52; cardIndex++) {
        String thisFile=Environment.getExternalStorageDirectory() + "/Android/data/cards/" + cardFileName[cardIndex];
        checkCardBitmap = BitmapFactory.decodeFile(thisFile);
        checkCardBitmap = Bitmap.createScaledBitmap(checkCardBitmap, cardWidth, cardHeight, false);
        Mat checkCardMat= new Mat();
        Mat cardMat= new Mat();
        Utils.bitmapToMat(checkCardBitmap, checkCardMat);
        Utils.bitmapToMat(cardBitmap, cardMat);

        checkCardMat.convertTo(checkCardMat, CvType.CV_32F);  //  <--didn't seem to help?
        cardMat.convertTo(cardMat,CvType.CV_32F);

        ////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////
        //this line generates the error:
        double compResult=Imgproc.compareHist(cardMat,checkCardMat,Imgproc.CV_COMP_CORREL); 
        ////////////////////////////////////////////////////////////////////////////////////////////


        comparisonResults[cardIndex] = compResult;
    }

    double max = comparisonResults[0];
    int matchedCardIndex=0;

    for (int i = 0; i < comparisonResults.length; i++) {
        if (comparisonResults[i] > max) {
            max = comparisonResults[i];
            matchedCardIndex=i;
        }
    }

    return cardValue[matchedCardIndex];
}
2015-11-30 12:57:46 -0600 commented question opencv sobel filter on real time video android

 

  I'm getting the following error at the line:

    public class HelloOpenCvActivity extends AppCompatActivity implements CameraBridgeViewBase.CvCameraViewListener2 {


    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference


What could be wrong?

 

2015-11-25 17:15:56 -0600 received badge  Editor (source)
2015-11-25 11:44:46 -0600 received badge  Supporter (source)
2015-11-25 11:43:44 -0600 asked a question Android Development with OpenCV

I've completed the Hello OpenCV tutorial at http://docs.opencv.org/2.4/doc/tutori... The tutorial is the last section, called Hello OpenCV Sample.

After completing the tutorial, I get an error on the line that reads: mOpenCvCameraView.setCvCameraViewListener(this);

The error is: Cannot resolve method setCvCameraViewListener(com.natebarlowjr.helloopencv.HelloOpenCvActivity)

Any help greatly appreciated.

2015-11-25 11:19:48 -0600 answered a question OpenCV Android Tutorials
2015-11-20 13:16:12 -0600 asked a question v3.0 on linux: undefined reference to `cv::Mat::

I cannot get v3.0 to compile on linux: cameradatafeed.cpp:676: error: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'

I do have the following necessary files included where these references are defined: cameradatafeed.h, opencv.hpp, mat.hpp etc.