Professional Documents
Culture Documents
Syntax
B = imrotate(A,angle)
B = imrotate(A,angle,method)
B = imrotate(A,angle,method,bbox)
gpuarrayB = imrotate(gpuarrayA,method)
Description
B = imrotate(A,angle) rotates image A by angle degrees in a counterclockwise direction
around its center point. To rotate the image clockwise, specify a negative value for angle.
imrotate makes the output image B large enough to contain the entire rotated image. imrotate
uses nearest neighbor interpolation, setting the values of pixels in B that are outside the rotated
image to 0 (zero).
Syntax
I2 = imcrop
I2 = imcrop(I)
X2 = imcrop(X,map)
___ = imcrop(obj)
I2 = imcrop(I,rect)
X2 = imcrop(X,map,rect)
___ = imcrop(XData,YData,___)
[___,rect2] = imcrop(___)
[XData2,YData2,___] = imcrop(___)
Description
I2 = imcrop creates an interactive image cropping tool associated with the image displayed in
the current figure, called the target image. The Crop Image tool is a moveable, resizable
rectangle that you can position over the image and perform the crop operation interactively using
the mouse. For more information about using the Crop Image tool, see Interactive Behavior.
imcrop returns the cropped image, I2. With this syntax and the other interactive syntaxes, the
Crop Image tool blocks the MATLAB command line until you complete the operation.
I2 = imcrop(I) displays the image I in a figure window and creates a cropping tool associated
with that image. I can be a grayscale image, a truecolor image, or a logical array. imcrop returns
the cropped image, I2.
X2 = imcrop(X,map) displays the indexed image X in a figure using the colormap map, and
creates a cropping tool associated with that image. After you crop the image, imcrop returns the
cropped indexed image, X2.
___ = imcrop(obj) creates a cropping tool associated with the object obj. obj can be an
image, axes, uipanel, or figure. If obj is an axes, uipanel, or figure, the cropping tool acts on the
first image found in the container object.
I2 = imcrop(I,rect) crops the image I. rect is a four-element position vector of the form
[xmin ymin width height] that specifies the size and position of the crop rectangle. imcrop
returns the cropped image, I2.
X2 = imcrop(X,map,rect) crops the indexed image X. map specifies the colormap used with X.
rect is a four-element position vector [xmin ymin width height] that specifies the size and
position of the cropping rectangle. imcrop returns the cropped indexed image, X2.
[XData2,YData2,___] = imcrop(___) returns two-element vectors that specify the XData and
YData of the target image.
Codng:
I = imread('circuit.tif')
J = imcrop(I);
close all;
clear all;
a=imread(your image.png);
moon = imread('moon.tif');
imshow(moon);
Syntax
imshow(I)
imshow(X,map)
imshow(filename)
imshow(I,[low high])
imshow(___,Name,Value)
himage = imshow(___)
imshow(I,RI)
imshow(X,RX,map)
imshow(gpuarrayIM,___)
Description
imshow(I) displays image I in a figure, where I is a grayscale, RGB (truecolor), or binary
image. For binary images, imshow displays pixels with the value 0 (zero) as black and 1 as white.
imshow optimizes figure, axes, and image object properties for image display.
imshow(X,map) displays the indexed image X with the colormap map. A colormap matrix can
have any number of rows, but it must have exactly 3 columns. Each row is interpreted as a color,
with the first element specifying the intensity of red light, the second green, and the third blue.
Color intensity can be specified on the interval 0.0 to 1.0.
imshow(filename) displays the image stored in the graphics file specified by filename.
imshow(I,[low high]) displays grayscale image I, specifying the display range as a two-
element vector, [low high]. For more information, see the DisplayRange parameter.
imshow(I,RI) displays the image I with associated 2-D spatial referencing object RI.
imshow(X,RX,map) displays the indexed image X with associated 2-D spatial referencing object
RX and colormap map.
imshow(gpuarrayIM,___) displays the image contained in a gpuArray. This syntax requires the
Parallel Computing Toolbox.
Resize:
Syntax
B = imresize(A,scale)
B = imresize(A,[numrows numcols])
[Y,newmap] = imresize(X,map,___)
___ = imresize(___,method)
___ = imresize(___,Name,Value)
gpuarrayB = imresize(gpuarrayA,scale)
gpuarrayB = imresize(gpuarrayA,[numrows numcols])
Description
B = imresize(A,scale) returns image B that is scale times the size of A. The input image A
can be a grayscale, RGB, or binary image. If A has more than two dimensions, imresize only
resizes the first two dimensions. If scale is from 0 through 1.0, B is smaller than A. If scale is
greater than 1.0, B is larger than A. By default, imresize uses bicubic interpolation.
B = imresize(A,[numrows numcols]) returns image B that has the number of rows and
columns specified by the two-element vector [numrows numcols].
[Y,newmap] = imresize(X,map,___) resizes the indexed image X where map is the colormap
associated with the image. By default, imresize returns a new, optimized colormap (newmap)
with the resized image. To return a colormap that is the same as the original colormap, use the
'Colormap' parameter.
___ = imresize(___,Name,Value) returns the resized image where Name,Value pairs control
various aspects of the resizing operation.
Simulink:
To create this simple model, you need four Simulink blocks. Blocks are the model elements that
define the mathematics of a system and provide input signals:
Scope Visualize and compare the input signal with the output signal.
Gray scale:
Grayscale is a range of shades of gray without apparent color. The darkest possible shade is
black, which is the total absence of transmitted or reflected light. The lightest possible shade is
white, the total transmission or reflection of light at all visible wavelength s. Intermediate shades
of gray are represented by equal brightness levels of the three primary colors (red, green and
blue) for transmitted light, or equal amounts of the three primary pigments (cyan, magenta and
yellow) for reflected light.
Histogram:
histogram( X ) creates a histogram plot of X . ... histogram displays the bins as rectangles such that the
height of each rectangle indicates the number of elements in the bin. histogram( X , nbins ) uses a
number of bins specified by the scalar, nbins .
Syntax
histogram(X)
histogram(X,nbins)
histogram(X,edges)
histogram('BinEdges',edges,'BinCounts',counts)
histogram(C)
histogram(C,Categories)
histogram('Categories',Categories,'BinCounts',counts)
histogram(___,Name,Value)
histogram(ax,___)
h = histogram(___)
Description
histogram(X) creates a histogram plot of X. The histogram function uses an automatic binning
algorithm that returns bins with a uniform width, chosen to cover the range of elements in X and
reveal the underlying shape of the distribution. histogram displays the bins as rectangles such
that the height of each rectangle indicates the number of elements in the bin.
histogram(X,edges) sorts X into bins with the bin edges specified by the vector, edges. Each
bin includes the left edge, but does not include the right edge, except for the last bin which
includes both edges.
histogram(C), where C is a categorical array, plots a histogram with a bar for each category in
C.
histogram(ax,___) plots into the axes specified by ax instead of into the current axes (gca).
The option ax can precede any of the input argument combinations in the previous syntaxes.
h = histogram(___) returns a Histogram object. Use this to inspect and adjust the properties
of the histogram. For a list of properties, see Histogram Properties.
What is a PNG file?
Portable Network Graphic
A PNG file is an image file stored in the Portable Network Graphic (PNG) format. It contains a
bitmap of indexed colors and uses lossless compression, similar to a .GIF file but without
copyright limitations. PNG files are commonly used to store graphics for web images.
A JPEG file is an image saved in a compressed graphic format standardized by the Joint
Photographic Experts Group (JPEG). It supports up to 24-bit color and is compressed using lossy
compression, which may noticeably reduce the image quality if high amounts of compression are
used. JPEG files are commonly used for storing digital photos and web graphics.