フィルターのクリア

I have an image (256 x 256) where its pixels ranging from 0 to 255. I need to built a look up table to map its values with image pixels.

3 ビュー (過去 30 日間)
Since I am a beginner, I cant find a way as how to start with coding for lookuptable. It would really helpful if you would help.
  2 件のコメント
Florian Bendl
Florian Bendl 2016 年 3 月 1 日
Please supply an example image and describe what has to be mapped to what. Maybe I can then help.
Neha W
Neha W 2016 年 3 月 1 日
編集済み: Neha W 2016 年 3 月 1 日
I have attached an image explaining the actual thing with simple example. Hope it helps you to understand my problem. Thank you.

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

採用された回答

Image Analyst
Image Analyst 2016 年 3 月 1 日
Use intlut(). Create your lookuptable, lut, then pass that plus your image into intlut() to get a new, transformed image.
  3 件のコメント
Image Analyst
Image Analyst 2016 年 3 月 1 日
編集済み: Image Analyst 2016 年 3 月 1 日
Yes, you would have to have an image to apply the lut to. But you said you have a 256x256 image already. Just load up the lut and apply it and then show the image.
grayImage = imread('Cameraman.tif');
subplot(2,2,1);
imshow(grayImage);
title('Original Image');
grayLevels = 0:255;
fx = 2*grayLevels+3;
% Make lut
lut = uint8(mod(fx,5));
outputImage = intlut(grayImage, lut);
subplot(2,2,2);
imshow(outputImage);
title('Output Image in range 0-255');
subplot(2,2,3);
imshow(outputImage, []);
title('Output Image Scaled so you can see it');
Of course if you have a formula and operations, then you can just apply those directly like Florian showed, so you wouldn't need a lookup table. Originally you didn't show that formula and intlut() is good for cases where you have some totally general mapping of some gray levels into others.
Neha W
Neha W 2016 年 3 月 15 日
Thank you very much. This has really helped me to understand the concept of look up table and to implement it.

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

その他の回答 (1 件)

Florian Bendl
Florian Bendl 2016 年 3 月 1 日
Oh, if I see that correct, then you need no lookup tabel...just do:
im = imread('your file');
% Convert image to double in case it is in some other number format
im = double(im);
% Calculate f(x)
im = 2*im + 3;
% Apply modulo 5
Result = mod( im, 5 )
  1 件のコメント
Neha W
Neha W 2016 年 3 月 1 日
編集済み: Neha W 2016 年 3 月 1 日
Oh. Thank you. It will surely help me a lot. One more thing, if I use different names to assign each step then, would that affect my result?

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

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by