How to show pixel values

I want to select a particular pixel in the image using impixel() but I also want to see on what cordinates I am clicking my mouse. For it I tried to use impixelinfo and impixelinfoval but none of them works when controls goes to impixel(). What is the solution?

回答 (1 件)

Image Analyst
Image Analyst 2016 年 11 月 4 日

0 投票

This works just fine:
rgbImage = imread('peppers.png'); % Sample image.
imshow(rgbImage);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Setup impixelinfo
hp = impixelinfo();
hp.Units = 'normalized'; % So Position values can go between 0 and 1 no matter how many pixels are on the screen.
hp.Position = [.3, .95, .7, .05]
What did you do such that it did not work???

3 件のコメント

Navdeep Singh
Navdeep Singh 2016 年 11 月 4 日
But in this code you have not used impixel() with which impixelinfo() is not working. Here is the code.
imshow(uint8(img));
[col,row,p]=impixel();
impixelinfo;
I want that when control goes to impixel(), impixelinfo should work.
Image Analyst
Image Analyst 2016 年 11 月 4 日
Sorry, it seems the way impixel() works, when you're in that mode it seems to turn off the "live" status line update that impixelinfo() provides. Send feedback to the Mathworks that you don't want that.
Navdeep Singh
Navdeep Singh 2016 年 11 月 4 日
Ok, thanks for your help!!

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

タグ

タグが未入力です。

質問済み:

2016 年 11 月 4 日

コメント済み:

2016 年 11 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by