Forums - fastcvNCCPatchC.cpp@853: (iNCC >= -128) && (iNCC <= 128) Assertion failed

7 posts / 0 new
Last post
fastcvNCCPatchC.cpp@853: (iNCC >= -128) && (iNCC <= 128) Assertion failed
martint
Join Date: 30 Oct 13
Posts: 8
Posted: Wed, 2014-10-15 12:19

I'm using the fcvNCCPatchesOnRectu8 function that appeared in FastCV 1.5

 

I managed to get it working correctly. However, performance wise is slower than OpenCV matchTemplate on and Android LG G2 smartphone. A bit disappointing.

 

Then I found that I needed to enable the fastest implementation available with:

fcvSetOperationMode( (fcvOperationMode) FASTCV_OP_PERFORMANCE );

 

However when I use this initialisation code the App crashes at the fcvNCCPatchesOnRectu8 and in the LogCat I see:

E/fastcv_lib_log(28072): vendor/qcom/proprietary/fastcv-noship/src/cpu/fastcvNCCPatchC.cpp@853: (iNCC >= -128) && (iNCC <= 128) Assertion failed

 

As I don't have the source code I don't know how to debug this assertion. It worked correctly before I added the initialisation code.

 

Any help?

  • Up0
  • Down0
jeff4s Moderator
Join Date: 4 Nov 12
Posts: 106
Posted: Wed, 2014-10-15 18:45

Hi,

In theory that error should not happen. Can you log the input data for this API and put them in a zip file? You can post it or deliver it for us to investigate the issue.

Thanks,

-Jeff

  • Up0
  • Down0
martint
Join Date: 30 Oct 13
Posts: 8
Posted: Thu, 2014-10-16 10:09

Hi Jeff,

 

I have made a self contained example that reproduces the assertion. See attached file.

 

To test it I just call my test() function from an android ndk app.

 

The test function just generates a random image using opencv. Then I extract a 16x16 region from the first image to use as a patch. The assertion only happens in android when I uncomment the first line of code 

//fcvSetOperationMode( (fcvOperationMode) FASTCV_OP_PERFORMANCE );

 

If I leave it commented I don't get the assertion and I get some matching location in best_xs, best_ys

 

The assertion doesn't occur in Windows even if I uncomment the  fcvSetOperationMode line.

 

Martin

 

I just realised I can't attach files to a reply. here is the code:

 

#include "opencv2/core/core.hpp"
#include <fastcv/fastcv.h>
#include <vector>
 
using namespace cv;
using namespace std;
 
void test()
{
 
//If I uncomment the line below I get the assertion.
//fcvSetOperationMode( (fcvOperationMode) FASTCV_OP_PERFORMANCE );
 
uint32_t srcStride =0;    
uint32_t filterLowVariance = 0; 
uint32_t doSubPixel = 1;
int num_searches = 1;
 
vector<uint32_t> search_centers_x(num_searches, 0);
vector<uint32_t> search_centers_y(num_searches, 0);
vector<uint32_t> best_xs(num_searches, 0);
vector<uint32_t> best_ys(num_searches, 0);
vector<uint32_t> bestNCCs(num_searches, 0);
vector<float32_t> subXs(num_searches, 0);
vector<float32_t> subYs(num_searches, 0);
int result;    
 
uint32_t patch_size = 16;
uint32_t search_size = 31;
 
Mat test_image =  Mat(160, 120, CV_8U);
randu(test_image, 0, 255);
Mat patch;
patch = test_image(Rect(test_image.cols/2,test_image.rows/2, patch_size, patch_size)).clone();
 
search_centers_x[0] = test_image.cols/2;
search_centers_y[0] = test_image.rows/2;
 
    result = fcvNCCPatchesOnRectu8(patch.data,
                                patch_size,
                                patch_size,
                                test_image.data,
                                test_image.cols,
                                test_image.rows,
                                srcStride,
                                &search_centers_x[0],
                                &search_centers_y[0],
                                search_size,
                                search_size,
                                filterLowVariance,
                                &best_xs[0],                                
                                &best_ys[0],
                                &bestNCCs[0],
                                doSubPixel,
                                &subXs[0],
                                &subYs[0],
                                num_searches); 
                                
cout <<  result << ", " << best_xs[0] << ", " << best_ys[0] << endl;                               
}

 

 

  • Up0
  • Down0
martint
Join Date: 30 Oct 13
Posts: 8
Posted: Mon, 2014-10-27 13:01

Hi Jeff,

Did you get my reply? I can't see it posted in the thread.

Martin

  • Up0
  • Down0
martint
Join Date: 30 Oct 13
Posts: 8
Posted: Mon, 2014-10-27 13:15

Oh well, now I see that my last reply appears in the thread!

 

I'll repost the message that I posted on the 15th Oct by pressing “Post reply” at the bottom of the page rather than the “reply” near the post.

 

The code below produces the assert when I uncomment the first line fcvSetOperationMode( (fcvOperationMode) FASTCV_OP_PERFORMANCE ); otherwise it runs as expected.

 

 

#include "opencv2/core/core.hpp"
#include <fastcv/fastcv.h>
#include <vector>
 
using namespace cv;
using namespace std;
 
void test()
{
 
//If I uncomment the line below I get the assertion.
//fcvSetOperationMode( (fcvOperationMode) FASTCV_OP_PERFORMANCE );
 
uint32_t srcStride =0;    
uint32_t filterLowVariance = 0; 
uint32_t doSubPixel = 1;
int num_searches = 1;
 
vector<uint32_t> search_centers_x(num_searches, 0);
vector<uint32_t> search_centers_y(num_searches, 0);
vector<uint32_t> best_xs(num_searches, 0);
vector<uint32_t> best_ys(num_searches, 0);
vector<uint32_t> bestNCCs(num_searches, 0);
vector<float32_t> subXs(num_searches, 0);
vector<float32_t> subYs(num_searches, 0);
int result;    
 
uint32_t patch_size = 16;
uint32_t search_size = 31;
 
Mat test_image =  Mat(160, 120, CV_8U);
randu(test_image, 0, 255);
Mat patch;
patch = test_image(Rect(test_image.cols/2,test_image.rows/2, patch_size, patch_size)).clone();
 
search_centers_x[0] = test_image.cols/2;
search_centers_y[0] = test_image.rows/2;
 
    result = fcvNCCPatchesOnRectu8(patch.data,
                                patch_size,
                                patch_size,
                                test_image.data,
                                test_image.cols,
                                test_image.rows,
                                srcStride,
                                &search_centers_x[0],
                                &search_centers_y[0],
                                search_size,
                                search_size,
                                filterLowVariance,
                                &best_xs[0],                                
                                &best_ys[0],
                                &bestNCCs[0],
                                doSubPixel,
                                &subXs[0],
                                &subYs[0],
                                num_searches); 
                                
cout <<  result << ", " << best_xs[0] << ", " << best_ys[0] << endl;                               
}
  • Up0
  • Down0
jeff4s Moderator
Join Date: 4 Nov 12
Posts: 106
Posted: Mon, 2014-10-27 15:50

Martin,

Thank you for reporting this issue. A bug was found and fixed for upcoming 1.6.0 release. FastCV 1.6.0 release will be posted soon.

Appreciate your help in improving FastCV.

Cheers,

-Jeff

 

 

  • Up0
  • Down0
martint
Join Date: 30 Oct 13
Posts: 8
Posted: Mon, 2014-10-27 16:23

That's great! I look forward to trying FastCV 1.6

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.