mapping a matrix to array to new matrix (mapping image to tone image )

1 回表示 (過去 30 日間)
daniel zayed
daniel zayed 2018 年 11 月 4 日
コメント済み: daniel zayed 2018 年 11 月 5 日
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 .

採用された回答

Image Analyst
Image Analyst 2018 年 11 月 5 日
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
  1 件のコメント
daniel zayed
daniel zayed 2018 年 11 月 5 日
i think the last line works, thanks man :)

サインインしてコメントする。

その他の回答 (1 件)

Akira Agata
Akira Agata 2018 年 11 月 5 日
Like the following ?
reshape(B(A(:)+1),size(A))
  1 件のコメント
daniel zayed
daniel zayed 2018 年 11 月 5 日
thank you man , but it does not do the required !

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by