Display Pixel Values in Image - Alternative to `showPixelValues()`

4 ビュー (過去 30 日間)
Royi Avital
Royi Avital 2017 年 9 月 3 日
コメント済み: Image Analyst 2023 年 8 月 22 日
Hello,
I would like to display an image and its pixel values in a similar manner to showPixelValues().
What I need is to be able to display it on an Axes Object on my own.
Namely something like:
hFigure = figure();
hAxes = axes();
DisplayImagePixelsValues(hAxes, mInputImage);
% Now set the properties of the axis.
Are there any alternatives to `showPixelValues()`? Something with more user control.
Thank You.
---
Update
According to answers it seems I wasn't clear.
I don't want to show data of a current axis or something.
I want a function which the input is a matrix (Small one) and the output is a regular axis object with result of an image with text of the pixels values.
From there I'd like to be able to customize this axes to my wishes.

回答 (3 件)

Image Analyst
Image Analyst 2017 年 9 月 3 日
How about impixelinfo()?
  3 件のコメント
Image Analyst
Image Analyst 2017 年 9 月 3 日
If not, then you'll just have to use text() to put up text labels over the image pixels.
Royi Avital
Royi Avital 2017 年 9 月 4 日
Hi, I looked into that. But I'd prefer having something which displays in a Figure Object (For exporting purposes). Has anyone implemented something like showPixelValues() in low level?

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


Walter Roberson
Walter Roberson 2017 年 9 月 3 日
The existing File Exchange contribution you linked to, does an imshow() without any parent, so it will display inside the current axes.
However, I discovered recently that if you imshow() and the current axes is at the default position, that imshow sets up conditions so that the axes will typically be deleted on the next graphics operation. You can avoid that by setting a non-default Position for the axes.
In any case you can easily edit the File Exchange Contribution to add a 'Parent' property to the imshow() calls and other calls.
  9 件のコメント
Walter Roberson
Walter Roberson 2017 年 9 月 6 日
What HTML code? The routine you linked to does not create HTML. Which routine are you looking at that produces HTML?
Royi Avital
Royi Avital 2017 年 9 月 7 日

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


Sindhu
Sindhu 2023 年 8 月 22 日
I need to display the pixel value in satellite image?
  1 件のコメント
Image Analyst
Image Analyst 2023 年 8 月 22 日
Display how?
help impixelinfo
IMPIXELINFO Pixel Information tool. IMPIXELINFO creates a pixel information tool in the current figure. The pixel information tool displays information about the pixel in an image that the cursor is positioned over. The tool can display pixel information for all the images in a figure. The pixel information tool is a uipanel object, positioned in the lower-left corner of the figure, that contains the text string "Pixel Info" followed by the pixel information. The information displayed depends on the image type, as shown below. If the cursor is outside of the image area in the figure, the pixel information tool displays the default string. Image Type Default String Example ---------- -------------- ----------------- Intensity (X,Y) Intensity (13,30) 82 Indexed (X,Y) <index> [R G B] (2,6) <4> [0.29 0.05 0.32] Binary (X,Y) BW (12,1) 0 Truecolor (X,Y) [R G B] (19,10) [15 255 10] If you want to display pixel information without the "Pixel Info" label, use IMPIXELINFOVAL. IMPIXELINFO(H) creates a pixel information tool in the figure specified by the handle H, where H is an image, axes, uipanel, or figure object. Axes, uipanel, or figure objects must contain at least one image object. IMPIXELINFO(HPARENT,HIMAGE) creates a pixel information tool in HPARENT that provides information about the pixels in HIMAGE. HIMAGE is a handle to an image or an array of image handles. HPARENT is a handle to the figure or uipanel object that contains the pixel information tool. HPANEL = IMPIXELINFO(...) returns a handle to the pixel information tool uipanel. Note ---- To copy the pixel information string to the clipboard, right-click while the cursor is positioned over a pixel. In the context menu, choose Copy pixel info. For a floating point image with the 'CDataMapping' property set to 'direct', the pixel information tool displays this default string: (X,Y) value <index> [R G B] Examples -------- h = imshow('hestain.png'); hp = impixelinfo; set(hp,'Position',[5 1 300 20]); figure subplot(1,2,1), imshow('liftingbody.png'); subplot(1,2,2), imshow('autumn.tif'); impixelinfo See also IMPIXELINFOVAL, IMTOOL. Documentation for impixelinfo doc impixelinfo

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

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by