How Can I Take the Inverse of an Image Matrix in MATLAB?

Click For Summary

Discussion Overview

The discussion revolves around the process of taking the inverse of an image matrix in MATLAB, specifically addressing the error encountered when attempting to use the 'inv' function on a matrix derived from an image file. The scope includes technical explanations and clarifications related to MATLAB functions and data types.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant reports an error when trying to use the 'inv' function on an image matrix, indicating that 'inv' is not defined for 'uint8' data types.
  • Another participant expresses confusion about the programming language being used and suggests an incorrect function call.
  • A third participant notes that 'imread()' and 'inv()' are not standard functions in C++, implying a misunderstanding of the context.
  • A later reply clarifies that 'imread()' returns an array of 8-bit unsigned integers and that 'inv()' requires a square matrix of floating-point numbers, questioning the purpose of inverting an image matrix.
  • One participant suggests converting the image matrix to double precision using 'double(A)' before applying 'inv()' to avoid the error.

Areas of Agreement / Disagreement

There is no consensus on the necessity or purpose of inverting an image matrix, as some participants express confusion about the intent behind the operation. Multiple viewpoints on the correct approach to resolve the error are presented.

Contextual Notes

Participants highlight the need for specific data types when using certain functions in MATLAB, indicating that the original data type of the image matrix affects the ability to compute its inverse.

Az83
Messages
7
Reaction score
0
I'm trying to take the inverse of an image matrix by doing the following:

>> A=imread ('noise.jpg');
>> inv(A)

But I'm getting the following error:

? Undefined function or method 'inv' for input arguments of type 'uint8'.

How can I change the image matrix so that I can take the inverse of it?
 
Technology news on Phys.org
Erm what?! hah

well what lanagauge is that?! Matlab?
maby try inv('noise.jpg') :S

hmmm i duno not sure would be easier to know what language your doing it in and what functions or methods you have available.
 
If this is C++, you must be using some non-standard add-on library. imread() and inv() are not standard C++ functions, as far as I know.
 
Az83 said:
I'm trying to take the inverse of an image matrix by doing the following:

>> A=imread ('noise.jpg');
>> inv(A)

But I'm getting the following error:

? Undefined function or method 'inv' for input arguments of type 'uint8'.

How can I change the image matrix so that I can take the inverse of it?
I recognise this as MATLAB. It would have helped if you had said so.

imread() takes an image file and returns an N x M x 3 array of 8-bit unsigned integers. inv() expects an N x N array of floating points.

I have to ask why would you want to invert an image array? I don't understand the point.
 
I also don't understand why you'd want the matrix inverse of an image, but you can use this:

inv(double(A))

You just need to convert the array to the double-precision floating-point datatype before inv() will know what to do with it.

- Warren
 

Similar threads

Replies
2
Views
2K
  • · Replies 23 ·
Replies
23
Views
8K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K