| Contents | Index |
imgmodel = imagemodel(himage)
imgmodel = imagemodel(himage) creates an image model object associated with a target image. The target image himage is a handle to an image object or an array of handles to image objects.
imagemodel returns an image model object or, if himage is an array of image objects, an array of image model objects.
imagemodel works by querying the image object's CData. For a single or int16 image, the image object converts its CData to double. For example, in the case of h = imshow(int16(ones(10))), class(get(h,'CData')) returns 'double'. Therefore, getClassType(imgmodel) returns 'double'.
An image model object stores information about an image such as class, type, display range, width, height, minimum intensity value, and maximum intensity value.
The image model object supports methods that you can use to access this information, get information about the pixels in an image, and perform special text formatting. Brief descriptions of these methods follow.
imagemodel supports the following methods. Type methods imagemodel to see a list of methods, or type help imagemodel/methodname for more information about a specific method.
str = getClassType(imgmodel) returns a string indicating the class of the image, where imgmodel is a valid image model and str is a text string, such as 'uint8'.
disp_range = getDisplayRange(imgmodel), where imgmodel is a valid image model and disp_range is an array of doubles such as [0 255], returns a double array containing the minimum and maximum values of the display range for an intensity image. For image types other than intensity, the value returned is an empty array.
height = getImageHeight(imgmodel), where imgmodel is a valid image model and height is a double scalar, returns a double scalar containing the number of rows.
str = getImageType(imgmodel), where imgmodel is a valid image model and str is one of the text strings ('intensity', 'truecolor', 'binary', or 'indexed'), returns a text string indicating the image type.
width = getImageWidth(imgmodel), where imgmodel is a valid image model and width is a double scalar, returns a double scalar containing the number of columns.
minval = getMinIntensity(imgmodel), where imgmodel is a valid image model and minval is a numeric value, returns the minimum value in the image calculated as min(Image(:)). For an intensity image, the value returned is the minimum intensity. For an indexed image, the value returned is the minimum index. For any other image type, the value returned is an empty array. The class of minval depends on the class of the target image.
maxval = getMaxIntensity(imgmodel), where imgmodel is a valid image model and maxval is a numeric value, returns the maximum value in the image calculated as max(Image(:)). For an intensity image, the value returned is the maximum intensity. For an indexed image, the value returned is the maximum index. For any other image type, the value returned is an empty array. The class of maxval depends on the class of the target image.
fun = getNumberFormatFcn(imgmodel), where imgmodel is a valid image model, returns the handle to a function that converts a numeric value into a string.
For example, str = fun(getPixelValue(imgmodel, 100, 100)) converts the numeric return value of the getPixelValue method into a text string.
str = getPixelInfoString(imgmodel, row, column), where str is a character array, imgmodel is a valid image model, and row and column are numeric scalar values, returns a text string containing the value of the pixel at the location specified by row and column. For example, for an RGB image, the method returns a text string such as '[66 35 60]'.
fun = getPixelRegionFormatFcn(imgmodel), takes a valid image model, imgmodel, and returns fun, a handle to a function that accepts the location (row, column) of a pixel in the target image and returns the value of the pixel as a specially formatted text string. For example, when used with an RGB image, this function returns a text string of the form 'R:000 G:000 B:000' where 000 is the actual pixel value.
str = fun(100,100)
val = getPixelValue(imgmodel, row, column), where imgmodel is a valid image model and row and column are numeric scalar values, returns the value of the pixel at the location specified by row and column as a numeric array. The class of val depends on the class of the target image.
str = getDefaultPixelInfoString(imgmodel), where imgmodel is a valid image model, returns a text string indicating the pixel information type. This string can be used in place of actual pixel information values. Depending on the image type, str can be the text string 'Intensity','[R G B]','BW', or '<Index> [R G B]'.
str = getDefaultPixelRegionString(imgmodel), where imgmodel is a valid image model, returns a text string indicating the type of information displayed in the Pixel Region tool for each image type. This string can be used in place of actual pixel values. Depending on the image type, str can be the text string '000','R:000 G:000 B:000]', '0', or '<000> R:0.00 G:0.00 B:0.00'.
val = getScreenPixelRGBValue(imgmodel, row, col) returns the screen display value of the pixel at the location specified by row and col as a double array. imgmodel is a valid image model, row and col are numeric scalar values, and val is an array of doubles, such as [0.2 0.5 0.3].
Create an image model.
h = imshow('peppers.png');
im = imagemodel(h);figure,subplot(1,2,1)
h1 = imshow('hestain.png');
subplot(1,2,2)
h2 = imshow('coins.png');
im = imagemodel([h1 h2]);

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |