フィルターのクリア

how to make a programme for colors value from image?

1 回表示 (過去 30 日間)
Dilshad Ahmad
Dilshad Ahmad 2016 年 9 月 23 日
コメント済み: Dilshad Ahmad 2016 年 9 月 26 日
It is my final project , I want to make a programme that take image from user when user click on image the programme give RGB value from image.

採用された回答

Massimo Zanetti
Massimo Zanetti 2016 年 9 月 23 日
Hi Dilshad, what you want is very simple. Follow this code.
%load image from Matalb demo images (or load your own color image)
rgb = imread('peppers.png');
%display it on the screen
image(rgb);
Now, if you look in the toolbar in the Figure containing your image, you will find an icon "Data Cursor". Press on it and then select a pixel in the image. You will finally read the X,Y coordinates of the pixel you selected and its RGB values in a pop-up window. Hope it helped. Max
  3 件のコメント
Massimo Zanetti
Massimo Zanetti 2016 年 9 月 26 日
Ok, then you will need something like this one maybe.
img = imread('peppers.png');
h = imshow(img,[]);
hText = impixelinfoval(gcf,h);
set(hText,'FontWeight','bold');
set(hText,'FontSize',10);
This will give you information about any pixel over which you are pointing the mouse on (without clicking on it).
Dilshad Ahmad
Dilshad Ahmad 2016 年 9 月 26 日
Thanks Bro I will try it.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2016 年 9 月 23 日
Simply call impixelinfo() to see the image (x,y) and intensity value as the user mouses around over the image.
hp = impixelinfo();
Or if you want to have them click on a point:
uiwait(helpdlg('Click on a point'));
[x, y] = ginput(1);
pixelValue = impixel(yourImage, round(x), round(y))
Or you can use imtool(yourImage) to bring up a GUI where the user can do even more.
  1 件のコメント
Dilshad Ahmad
Dilshad Ahmad 2016 年 9 月 24 日
Thanks Bro I will try it.

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by