mapping a matrix to array to new matrix (mapping image to tone image )
2 views (last 30 days)
Show older comments
daniel zayed
on 4 Nov 2018
Commented: daniel zayed
on 5 Nov 2018
i have a matrix A n*m for example A,3*3 = A[0,3,10;255,6,8;7,9,9] the values between 0 to 255 and i have array B 1*256 that includes all the numbers from 0 to 255 not sorted , (ex. [5,0,4,255,...]) i need to map the matrix A to B - for every value i in A i want to map it to B(i+1) i am required to do it in one line code !!!
in this example the first element in A 0 will convert to 5 index 1 in B and second element 3 will be 255 index 4 in B in the new matrix .
0 Comments
Accepted Answer
Image Analyst
on 5 Nov 2018
How about intlut()?
A = uint8([0,3,10;255,6,8;7,9,9])
B = uint8(randperm(256)-1)
output = intlut(A, B) % A and B must be integers
More Answers (1)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!