Ask Your Question
1

adjoint of matrix

asked 2018-07-18 04:47:27 -0600

saniket123 gravatar image

updated 2018-07-18 04:57:57 -0600

I have gray-channel image of size 128X128 And i want to find adjoint of the image. i know i have to first find cofactor then transpose to find adjoint. But is any library or function which opencv support to find adjoint of image of matrix form.

Thanks in advance

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-07-18 05:01:31 -0600

berak gravatar image

updated 2018-07-18 05:08:18 -0600

since the adjunct of a matrix is it's determinant, multiplied by the inverse, -- we can just write it like that !

taking the wikipedia example :

Mat_<float> A(3,3); 
A << -3,2,-5,
     -1,0,-2,
      3,-4,1;

Mat A_adj = determinant(A) * A.inv();
cout << A_adj << endl;

output:

[-8, 18, -4;
 -5, 12, -1;
 4, -6, 2]

if you want to use a grayscale image here, you'll have to convert it to float first:

Mat im = ...
Mat fimg;
img.convertTo(fimg, CV_32F);
edit flag offensive delete link more

Comments

thank you @berak

saniket123 gravatar imagesaniket123 ( 2018-07-18 05:33:56 -0600 )edit

@saniket123 if you get a correct answer please upvote and mark the answer as correct.

sturkmen gravatar imagesturkmen ( 2018-11-01 18:08:13 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-07-18 04:47:27 -0600

Seen: 301 times

Last updated: Jul 18 '18