|
|
@ -13,6 +13,8 @@ namespace OpenCV |
|
|
|
IplImage zoomout; |
|
|
|
IplImage zoomout; |
|
|
|
IplImage resize; |
|
|
|
IplImage resize; |
|
|
|
IplImage slice; |
|
|
|
IplImage slice; |
|
|
|
|
|
|
|
IplImage symm; |
|
|
|
|
|
|
|
IplImage rotate; |
|
|
|
|
|
|
|
|
|
|
|
public IplImage GrayScale(IplImage src) |
|
|
|
public IplImage GrayScale(IplImage src) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -84,24 +86,44 @@ namespace OpenCV |
|
|
|
return slice; |
|
|
|
return slice; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IplImage Symmetry(IplImage src, FlipMode mode) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
symm = new IplImage(src.Size, BitDepth.U8, 3); |
|
|
|
|
|
|
|
Cv.Flip(src, symm, mode); |
|
|
|
|
|
|
|
return symm; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IplImage Rotate(IplImage src, double angle) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
rotate = new IplImage(src.Size, BitDepth.U8, 3); |
|
|
|
|
|
|
|
CvMat matrix = Cv.GetRotationMatrix2D(new CvPoint2D32f(src.Width / 2, src.Height / 2), angle, 1); |
|
|
|
|
|
|
|
Cv.WarpAffine(src, rotate, matrix, Interpolation.Linear, CvScalar.ScalarAll(0)); |
|
|
|
|
|
|
|
return rotate; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Release(params IplImage[] images) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for (int i = 0; i < images.Length; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (images[i] != null) |
|
|
|
|
|
|
|
Cv.ReleaseImage(images[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (gray != null) |
|
|
|
Release( |
|
|
|
Cv.ReleaseImage(gray); |
|
|
|
gray, |
|
|
|
if (inversion != null) |
|
|
|
inversion, |
|
|
|
Cv.ReleaseImage(inversion); |
|
|
|
bin, |
|
|
|
if (bin != null) |
|
|
|
blur, |
|
|
|
Cv.ReleaseImage(bin); |
|
|
|
zoomin, |
|
|
|
if (blur != null) |
|
|
|
zoomout, |
|
|
|
Cv.ReleaseImage(blur); |
|
|
|
resize, |
|
|
|
if (zoomin != null) |
|
|
|
slice, |
|
|
|
Cv.ReleaseImage(zoomin); |
|
|
|
symm, |
|
|
|
if (zoomout != null) |
|
|
|
rotate |
|
|
|
Cv.ReleaseImage(zoomout); |
|
|
|
); |
|
|
|
if (resize != null) |
|
|
|
|
|
|
|
Cv.ReleaseImage(resize); |
|
|
|
|
|
|
|
if (slice != null) |
|
|
|
|
|
|
|
Cv.ReleaseImage(slice); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|