The invert function failed to return the determinant of src (Bug #1976)


Added by Ming-Ming Cheng almost 13 years ago. Updated almost 13 years ago.


Status:Done Start date:2012-05-23
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:2.4.1
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

I'm using the OpenCV 2.4, Visual studio 2010, Win7. The invert function failed to return the determinant of src as described in the refman. It always return 1 no mater what's the input Matrix src.

Here is a sample code to reoccur this issue.

1int main(int argc, char* argv[])
2{
3    Matx22d mat(2, 0, 0, 2), inv;
4    printf("Determination = %g, %g\n", invert(mat, inv, CV_LU), determinant(mat));
5    return 0;
6}

The output is: Determination = 1, 4, which is incorrect.


Associated revisions

Revision 658282fc
Added by Andrey Pavlenko about 11 years ago

Merge pull request #1976 from alalek:ocl_multiple_command_queues

History

Updated by Andrey Kamaev almost 13 years ago

  • Description changed from I'm using the OpenCV 2.4, Visual studio 2010, Win7. The invert function f... to I'm using the OpenCV 2.4, Visual studio 2010, Win7. The @invert@ function... More
  • Category set to core
  • Assignee set to Vadim Pisarevsky

Updated by Vadim Pisarevsky almost 13 years ago

sorry, it was bug in documentation that was fixed in r8438. cv::invert() returns 0/1 depending on whether input matrix is singular or not. It does not return determinant.

  • Status changed from Open to Done
  • Target version set to 2.4.1

Updated by Ming-Ming Cheng almost 13 years ago

Since CV_LU naturally produce determinate with nearly no overhead cost, it’s better to return determinate as in earlier versions of OpenCV. In my application of building GMM models, I need both inverse and determinate, which I currently use inverse() to get former and determinate() to get later. The best expected is change this function according to the document, which would help me reduce 50% computation in this application.

Also available in: Atom PDF