30-04-2021



‘Min’ is function used in Matlab to find minimum or smallest value from database. This function can be applied on any type of dataset like integers, characters, floating numbers, etc. Along with type of dataset it can be applied on any dimensions of data such as arrays, vectors, two dimensional elements, three dimensional elements, etc. Label Maximum and Minimum in MatLab Figure. Sometimes it is required to label the minimum and maximum values of a plot in a Matlab figure. The code snippet below demonstrate that functionality, for minimum and maximum values along the y-axis.% plot the data data= 2.5: 0.025: 10;% x-axis data fn1 = log( data.^ 2)./data + 0.035.data;% y.

MATLAB Function Reference
min

Minimum elements of an array

Syntax

Description

C = min(A)returns the smallest elements along different dimensions of an array.

If A is a vector, min(A) returns the smallest element in A.

If A is a matrix, min(A) treats the columns of A as vectors, returning a row vector containing the minimum element from each column.

If A is a multidimensional array, min operates along the first nonsingleton dimension.

C = min(A,B)returns an array the same size as A and B with the smallest elements taken from A or B.

C = min(A,[],dim)returns the smallest elements along the dimension of A specified by scalar dim. For example, min(A,[],1) produces the minimum values along the first dimension (the rows) of A.

[C,I] = min(...)finds the indices of the minimum values of A, and returns them in output vector I. If there are several identical minimum values, the index of the first one found is returned.

Remarks

For complex input A, min returns the complex number with the largest complex modulus (magnitude), computed with min(abs(A)), and ignores the phase angle, angle(A). The min function ignores NaNs.

See Also

max, mean, median, sort


mfilenameminres

If one requires just the minimum intensity of an image, then min(Img (:)) would do the job; but if one is interested in the location of the intensity value, then the following code can be used:

Matlab Find Minimum Index

Similarly, the maximum intensity of an image and its location can be obtained by maxlnt = max(Img(:) ) ; [r, c, z] = find(Img maxlnt);

TABLE 2.1

List of MATLAB functions for image arithmetic

Min

Function

Description imabsdiff

Absolute difference of two images Add two images Complement an image Divide two images

Compute linear combination of two images Multiply two images Subtract two images imadd imcomplement imdivide imlincomb immultiply imsubtract

Note that there may be more than one pixel with the value of maxlnt in the image.

2.5.11 Image Arithmetic

Although image arithmetic can be performed using normal matrix operations, the Image Processing Toolbox includes special functions for it. Table 2.1 lists some such functions. Their main advantages, as mentioned in the MATLAB help pages, are

• No conversion to double data type is necessary. It should be noted that the operations are executed in double precision internally.

• Overflow is handled automatically

On Intel architecture processors, such functions can take advantage of the Intel Performance Primitives Library (IPPL), thus accelerating their execution time. The IPPL is a collection of basic functions used in signal and image processing.

2.5.12 Block Processing of Images

At times, block processing may be required when images exhibit some type of inhomogeneity, such as spatially varying noise characteristics, or when it is necessary to perform processing locally inside the image. In block processing, the image is divided into small distinct or overlapping blocks, and each block is processed separately. A nonuniform background or illumination is one of the best examples in which block processing may be helpful. Recall also that in Section 2.5.8.1, we performed pixel binning by using the block processing function. There are several functions in MATLAB that allow us to perform block processing: blkproc, im2col, col2im, nrfilter, and colfilt.

blkproc

Implement distinct block processing

im2col

Rearranges image blocks into columns

col2im

Reverses the operation of im2col,

rearranges the columns into blocks

nrfilter

Perform general sliding-neighborhood

operations

colfilt

Perform neighborhood operations

using columnwise functions

For the usage of these functions, the reader can refer to the MATLAB help pages.

2.6 Image Histogram

An intensity histogram represents the frequency of occurrence of intensities in an image. It is the approximation of the probability distribution function that intensities follow. Image histograms can be computed in several ways. For instance, the following statement

creates an image histogram in which nbins is the desired number of bins, and cbins denotes their centers. Figure 2.9 shows a synthetic image consisting of two normally distributed regions with means 10 and 20 and a standard deviation 2. Then the following code computes the histogram using 64 bins. The computed histogram is shown on the left of the Figure 2.9 using a bar plot.

Intensities

FIGURE 2.9

A gray-level image consisting of two normally distributed regions and its histogram on the right.

Matlab Minor Grid

Intensities

FIGURE 2.9

A gray-level image consisting of two normally distributed regions and its histogram on the right.

Img = [normrnd(10,2,64,32), normrnd(20,2,64,32)]; [h,cbins]=hist(Img(:),64); bar(cbins,h,1);

The functions imhist and histc are the other alternatives in computing image histograms. For the usage of these functions, the reader can refer to MATLAB help pages.

Continue reading here: Histogram

Was this article helpful?