zoom in/out

remotes/origin/master
syneffort 3 years ago
parent 0322980f86
commit 77db30ee31
  1. 2
      OpenCV/Form1.Designer.cs
  2. 3
      OpenCV/Form1.cs
  3. 20
      OpenCV/OpenCVClass.cs

@ -40,7 +40,6 @@ namespace OpenCV
this.pictureBoxIpl1.Location = new System.Drawing.Point(12, 12); this.pictureBoxIpl1.Location = new System.Drawing.Point(12, 12);
this.pictureBoxIpl1.Name = "pictureBoxIpl1"; this.pictureBoxIpl1.Name = "pictureBoxIpl1";
this.pictureBoxIpl1.Size = new System.Drawing.Size(640, 480); this.pictureBoxIpl1.Size = new System.Drawing.Size(640, 480);
this.pictureBoxIpl1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxIpl1.TabIndex = 0; this.pictureBoxIpl1.TabIndex = 0;
this.pictureBoxIpl1.TabStop = false; this.pictureBoxIpl1.TabStop = false;
// //
@ -49,7 +48,6 @@ namespace OpenCV
this.pictureBoxIpl2.Location = new System.Drawing.Point(658, 11); this.pictureBoxIpl2.Location = new System.Drawing.Point(658, 11);
this.pictureBoxIpl2.Name = "pictureBoxIpl2"; this.pictureBoxIpl2.Name = "pictureBoxIpl2";
this.pictureBoxIpl2.Size = new System.Drawing.Size(640, 480); this.pictureBoxIpl2.Size = new System.Drawing.Size(640, 480);
this.pictureBoxIpl2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxIpl2.TabIndex = 1; this.pictureBoxIpl2.TabIndex = 1;
this.pictureBoxIpl2.TabStop = false; this.pictureBoxIpl2.TabStop = false;
// //

@ -39,7 +39,8 @@ namespace OpenCV
OpenCVClass Converter = new OpenCVClass(); OpenCVClass Converter = new OpenCVClass();
pictureBoxIpl1.ImageIpl = src; pictureBoxIpl1.ImageIpl = src;
pictureBoxIpl2.ImageIpl = Converter.Blur(src); //pictureBoxIpl2.ImageIpl = Converter.ZoomIn(src);
pictureBoxIpl2.ImageIpl = Converter.ZoomOut(src);
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -9,6 +9,8 @@ namespace OpenCV
IplImage inversion; IplImage inversion;
IplImage bin; IplImage bin;
IplImage blur; IplImage blur;
IplImage zoomin;
IplImage zoomout;
public IplImage GrayScale(IplImage src) public IplImage GrayScale(IplImage src)
{ {
@ -38,6 +40,20 @@ namespace OpenCV
return blur; return blur;
} }
public IplImage ZoomIn(IplImage src)
{
zoomin = new IplImage(new CvSize(src.Width * 2, src.Height * 2) , BitDepth.U8, 3);
Cv.PyrUp(src, zoomin, CvFilter.Gaussian5x5);
return zoomin;
}
public IplImage ZoomOut(IplImage src)
{
zoomout = new IplImage(new CvSize(src.Width / 2, src.Height / 2), BitDepth.U8, 3);
Cv.PyrDown(src, zoomout, CvFilter.Gaussian5x5);
return zoomout;
}
public void Dispose() public void Dispose()
{ {
if (gray != null) if (gray != null)
@ -48,6 +64,10 @@ namespace OpenCV
Cv.ReleaseImage(bin); Cv.ReleaseImage(bin);
if (blur != null) if (blur != null)
Cv.ReleaseImage(blur); Cv.ReleaseImage(blur);
if (zoomin != null)
Cv.ReleaseImage(zoomin);
if (zoomout != null)
Cv.ReleaseImage(zoomout);
} }
} }
} }

Loading…
Cancel
Save