MATLAB matrix strange operation
Show older comments
I've been trying to convert MATLAB code to python and found this line of code which looks weird to me:
S = favg(I+1);
Where favg is a 256-by-1 matrix, I is a 512-by-512 matrix and the result S is a 512-by-512 matrix.
Can anybody help me understand what S is? Thanks.
Answers (1)
Conceptually, I would have no idea what S is, since I don't know what I or favg are with essentially zero context.
As far as the operation goes, I would assume that I is an array of linear indices into favg. So the values within I should be in the range [0 255]. I'll guess that the +1 offset is because the array is uint8. Again, I can only guess. It would seem odd that favg would only have one channel if it were a color table.
If this were indeed some sort of indexed image operation (or something analogous), then that would probably make I the indexed image and S the grayscale image.
How's that for a guess?
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!