1. Construction Distance matrix:
X=[1 2 3 4;2 3 4 5];
D = Pdist (X);%d result is 2
Squareform (D)% converted to the form of a distance matrix
Ans =
0 2
2 0
2.
1, using Imcrop to do image cutting, or using rectangular blocks to extract image block area; 2, can use Pixval on (low version), or impixelinfo;
- CLC Clear all; Close all;
- Figure
- Imshow (' rice.png ');
- Impixelinfo
Copy Code 3, use the "Data cursor" icon in the Figure window to view; 4, use Imview to view;
- CLC Clear all; Close all;
- Imview (' rice.png ');
Copy Code |
3, Mean and mean2
>> a=[1 2 3;4 5 6];
>> B=mean (a)
b =
2.500000000000000 3.500000000000000 4.500000000000000
>> C=mean2 (a)
c =
3.500000000000000
Mean2 equivalent to mean (mean (a))
4. Find
A=[2 7 8 1 4 6 9;3 1 4 9 19 6 3];
S= (Find (a>5));% get the single subscript of the desired element
B=a (S);% get the desired element
5.
A (:) function is to convert matrix A to a column vector, which is a column, you can try.
As for. ' is the general transpose meaning, this one you obviously know.
Combine the above two known a (:). ' is to convert matrix A to a row vector, which is a row.
Add: ' Is the meaning of the conjugate transpose. When matrix A is a real matrix, he and. ' The function is the same, but when a is a complex matrix, the two are different, see the link below.
Refer to the link below for details.
Http://zhidao.baidu.com/question/329151444.html
Hope that you have some help, there are questions welcome to ask, satisfaction please accept.
6, [l,n]= bwlabel (IM);
STATS = Regionprops (L, ' Perimeter ');%%l is a marker matrix, and the image is divided into different areas for different marks.
W=[stats. Perimeter];
This function is used to measure a series of properties for each label area in the label Matrix L. Different positive integer elements in L correspond to different regions, for example: the element corresponding to the integer 1 in L is the corresponding region of the element in the 1;l equal to the integer 2 in the region 2;
The return value stats is a structure array of length Max (L (:)), and the corresponding fields of the structure array define the measures under the corresponding properties of each zone.
Properties can be a comma-delimited list of strings, an array of cells containing strings, a single string of ' All ' or ' basic '. If properties equals the string ' All ', the metrics in the table will be computed; if properties equals string ' Basic ', then the attribute: ' area ', ' centroid ' and ' BoundingBox ' will be computed. Here are all valid property strings.
Properties value measures the attributes or functions of an image area
Total number of pixels in each region of the ' area ' image
' BoundingBox ' contains the smallest rectangle of the corresponding area
' centroid ' centroid of each region (center of gravity)
' Majoraxislength ' The long axis length of the ellipse with the same standard second-order center moment as the region (in pixel sense)
' Minoraxislength ' the short axis length of the ellipse with the same standard second-order center moment as the region (in pixel sense)
' Eccentricity ' the eccentricity of the ellipse with the same standard second-order center moment as the region (can be used as a feature)
' Orientation ' the intersection of the long axis and the x-axis of the ellipse with the same standard second-order center moment as the region (degrees)
' Image ' has a logical matrix of the same size as an area
' Filledimage ' has the same size fill logical matrix as an area
The number of on pixels in the ' filledarea ' filled area image
' Convexhull ' contains the smallest convex polygon of an area
' Conveximage ' draws the smallest convex polygon in the area above
The number of on pixels in a convex polygon image of ' convexarea ' populated area
A topological invariants in the ' Eulernumber ' geometric topology--Euler number
' Extrema ' eight-directional region extremum Point
' Equivdiameter ' diameter of the circle with the same area as the area
The pixel ratio of ' solidity ' at the same time in the region and its smallest convex polygon
The pixel scale of ' Extent ' at the same time in the region and its minimum bounding rectangle
Index subscript for the ' pixelidxlist ' storage area pixels
' Pixellist ' stores the pixel coordinates of the above index
The perimeter of a closed curve connected by the ' perimeter ' boundary cell
Useful matlab functions (added continuously)