0

i'm trying to implement the Eigenface in android with opencv my problem is when i'm trying to show the eigenvectors returns form PCACompute in imageview it is black the size of each image is 128*128 first of all i'v read the images and store them in ArrayList , convert them to column matrix and pass it to PCACompute as shown below what should i do after that i know that i have to use PCAProject but i don't have any idea about it help me please

private void Test() {

    mTemp = new Mat();

    File directoryOfMatFiles = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "FacesDB"); // it points to the directory that contains mat files
    File[] contentOfDirectoryOfMatFiles = directoryOfMatFiles.listFiles();
    mImages = new ArrayList<>();


    for (File f : contentOfDirectoryOfMatFiles) {
        try {
            mTemp = Imgcodecs.imread(f.getAbsolutePath(), 0);

            mImages.add(mTemp);

        } catch (Exception e) {
           Log.e("Error","error");
        }
    }
        tv.setText("Count:" + mImages.size());

       mData = new Mat(1,128*128,CvType.CV_8UC1);
      for(int i=0; i < mImages.size(); i++) {
          mImages.set(i, mImages.get(i).reshape(1,1));
      }
         Core.vconcat(mImages, mData);

        mEigenFace = new Mat();
         mEigenValue = new Mat();
         mAvarage = new Mat();

        Core.PCACompute(mData, mAvarage, mEigenFace,mImages.size()-1);
        mAvarage= mAvarage.reshape(1, 128);
       bmp =   bmp.createBitmap(mAvarage.cols(), mAvarage.rows(), Bitmap.Config.ARGB_8888);Utils.matToBitmap(mat, bmp);
       imageView.setImageBitmap(bmp);
Ghayth
  • 1
  • 3
  • 1
    You'd better print it out and check it's values instead of converting to an RGB image. I don't think that it's values are integers in range [0,255]. – Miki Feb 04 '16 at 21:37
  • how can i print it ?, i tried to show them in image view but they were black can you tell me another way to print ? – Ghayth Feb 05 '16 at 08:58

0 Answers0