Exemple #1
0
 /// <summary>
 /// 副摄像头关闭
 /// </summary>
 public void btnCloseSub_Click()
 {
     if (bOpenSub)
     {
         GpySdImpl.LaCloseCamera(subIndex);
     }
 }
Exemple #2
0
 /// <summary>
 /// 右转
 /// </summary>
 public void btnRotateRightMain_Click()
 {
     if (bOpenMain)
     {
         GpySdImpl.LaRotateRight(mainIndex);
     }
 }
Exemple #3
0
 /// <summary>
 /// 高光
 /// </summary>
 public void btnHightLight_Click()
 {
     if (bOpenSub)
     {
         GpySdImpl.LaSetExposure(subIndex, false, -2);
     }
 }
Exemple #4
0
 /// <summary>
 /// 自动
 /// </summary>
 public void btnAuto_Click()
 {
     if (bOpenSub)
     {
         GpySdImpl.LaSetExposure(subIndex, true, -2);
     }
 }
Exemple #5
0
 /// <summary>
 /// 关闭主摄像头
 /// </summary>
 public void btnCloseMain_Click()
 {
     if (bOpenMain)
     {
         GpySdImpl.LaCloseCamera(mainIndex);
         bOpenMain = false;
     }
 }
Exemple #6
0
 /// <summary>
 /// 打开主摄像头
 /// </summary>
 public void btnOpenMain_Click(String pDeviceID)
 {
     mainIndex = GpySdImpl.LaGetCameraIndex("1bc3", "1100");
     if (GpySdImpl.LaOpenCamera(mainIndex, pictureBox1.Handle) == 0)
     {
         bOpenMain = true;
     }
 }
Exemple #7
0
 /// <summary>
 /// 副摄像头打开
 /// </summary>
 public void btnOpenSub_Click(String pDeviceID)
 {
     subIndex = GpySdImpl.LaGetCameraIndex("1bc3", "1101");
     if (GpySdImpl.LaOpenCamera(subIndex, pictureBox1.Handle) == 0)
     {
         bOpenSub = true;
         GpySdImpl.LaShowMask(subIndex, true);
         GpySdImpl.LaSetMouseMode(subIndex, 3);
     }
 }
Exemple #8
0
        private bool bOpenSub  = false;             //副头是否已打开


        /// <summary>
        /// 获取摄像头数量
        /// </summary>
        /// <returns></returns>
        public int btnGetCameraCount_Click(String pDeviceID)
        {
            if (!"01".Equals(pDeviceID))
            {
                return(-1);
            }
            int num = GpySdImpl.LaGetCameraCount();

            return(num);
        }
Exemple #9
0
        //主摄像头合成拍照返回base64位
        public String btnComposeMainBase64_Click(String file)
        {
            if (bOpenMain)
            {
                file = LocalPath + "\\" + file;
                //如果没有目录,则创建目录
                String dir = Path.GetDirectoryName(file);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                GpySdImpl.LaSetCaptureMode(mainIndex, 1);                       //设置拍照模式为合成拍照模式
                GpySdImpl.LaEnableAutoRotate(mainIndex, true);                  //开启自动纠偏
                //SD.LaSetJpgQuality(mainIndex, 50);                       //设置压缩比, 第二个参数取值1-100
                GpySdImpl.LaSetDPI(mainIndex, 350);

                if (File.Exists(file))
                {
                    File.Delete(file);
                }

                //String file = ("C:\\cde.jpg");
                GpySdImpl.LaCapture(mainIndex, file);


                //Image Im = Image.FromFile(file);
                //Bitmap Bm = new Bitmap(Im);

                //MemoryStream m = new MemoryStream();
                //Bm.Save(m, ImageFormat.Jpeg);
                ////String base64 = Convert.ToBase64String(m.GetBuffer());
                ////String base64 = Convert.ToBase64String(m.ToArray());
                //Im.Dispose();
                //Bm.Dispose();


                //String base64 = SD.LaCaptureBase64(mainIndex);
                //SD.AddImageItem(file);//显示
                GpySdImpl.LaSetCaptureMode(mainIndex, 0);                       //设置拍照模式为正常拍照
                GpySdImpl.LaEnableAutoRotate(mainIndex, false);                 //关闭自动纠偏

                String base64 = btnConvertBase64_Click(file);

                return(base64);
            }
            else
            {
                return(null);
            }
        }
Exemple #10
0
 /// <summary>
 /// 主摄像头拍照
 /// </summary>
 /// <param name="file"></param>
 public void btnCaptureMain_Click(String file)
 {
     if (bOpenMain)
     {
         file = LocalPath + "\\" + file;
         //如果没有目录,则创建目录
         String dir = Path.GetDirectoryName(file);
         if (!Directory.Exists(dir))
         {
             Directory.CreateDirectory(dir);
         }
         //GpySdImpl.LaSetJpgQuality(mainIndex, 50);
         GpySdImpl.LaSetDPI(mainIndex, 350);
         GpySdImpl.LaCapture(mainIndex, file);
         //GpySdImpl.AddImageItem(file);//显示
     }
 }
Exemple #11
0
        /// <summary>
        /// 副摄像头拍照,返回base64
        /// </summary>
        /// <returns></returns>
        public String btnCaptureSubBase64_Click(String file)
        {
            if (bOpenSub)
            {
                file = LocalPath + "\\" + file;
                //SD.LaSetJpgQuality(subIndex, 50);
                GpySdImpl.LaSetDPI(subIndex, 350);

                if (File.Exists(file))
                {
                    File.Delete(file);
                }
                //String file = ("c:\\abc.jpg");

                //如果没有目录,则创建目录
                String dir = Path.GetDirectoryName(file);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                GpySdImpl.LaCapture(subIndex, file);

                //Image Im = Image.FromFile(file);
                //Bitmap Bm = new Bitmap(Im);
                //MemoryStream m = new MemoryStream();
                //Bm.Save(m, ImageFormat.Jpeg);
                ////String base64 = Convert.ToBase64String(m.GetBuffer());
                //String base64 = Convert.ToBase64String(m.ToArray());
                //Im.Dispose();
                //Bm.Dispose();

                //File.Delete(file);
                //SD.AddImageItem(file);//显示

                //Write(base64, "d:\\人图像base64数据.txt");

                String base64 = btnConvertBase64_Click(file);

                return(base64);
            }
            else
            {
                return(null);
            }
        }
Exemple #12
0
        /// <summary>
        /// 主摄像头合成拍照
        /// </summary>
        /// <param name="file"></param>
        public void btnComposeMain_Click(String file)
        {
            if (bOpenMain)
            {
                file = LocalPath + "\\" + file;
                //如果没有目录,则创建目录
                String dir = Path.GetDirectoryName(file);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                GpySdImpl.LaSetCaptureMode(mainIndex, 1);                       //设置拍照模式为合成拍照模式
                GpySdImpl.LaEnableAutoRotate(mainIndex, true);                  //开启自动纠偏
                //GpySdImpl.LaSetJpgQuality(mainIndex, 50);                       //设置压缩比, 第二个参数取值1-100
                GpySdImpl.LaSetDPI(mainIndex, 350);
                GpySdImpl.LaCapture(mainIndex, file);
                //GpySdImpl.AddImageItem(file);//显示
                GpySdImpl.LaSetCaptureMode(mainIndex, 0);                       //设置拍照模式为正常拍照
                GpySdImpl.LaEnableAutoRotate(mainIndex, false);                 //关闭自动纠偏
            }
        }
Exemple #13
0
 /// <summary>
 /// 关闭翻拍照片功能
 /// </summary>
 /// <param name="iMode"></param>
 public void btnClosePhotoRecopy(int iMode)
 {
     GpySdImpl.LaSetPhotoReCap(mainIndex, false);
     GpySdImpl.LaSetDelBackMode(mainIndex, 0);
     GpySdImpl.LaSetMouseMode(mainIndex, 0);
 }
Exemple #14
0
 /// <summary>
 /// 开启翻拍照片功能
 /// </summary>
 /// <param name="iMode">0不去底色,1去蓝色,2去红色,3去绿色,4去白底</param>
 public void btnOpenPhotoRecopy(int iMode)
 {
     GpySdImpl.LaSetMouseMode(mainIndex, 1);
     GpySdImpl.LaSetDelBackMode(mainIndex, iMode);
     GpySdImpl.LaSetPhotoReCap(mainIndex, true);
 }
Exemple #15
0
 /// <summary>
 /// 滑动鼠标
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
 {
     GpySdImpl.LaOnWheel(pictureBox1.Handle, e.Delta);
 }
Exemple #16
0
 /// <summary>
 /// 抬起鼠标
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
 {
     GpySdImpl.LaOnLMouseRelease(pictureBox1.Handle, e.X, e.Y);
 }
Exemple #17
0
 /// <summary>
 /// 移动鼠标
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
 {
     GpySdImpl.LaOnMouseMoving(pictureBox1.Handle, e.X, e.Y);
 }
Exemple #18
0
 /// <summary>
 /// 按下鼠标
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     GpySdImpl.LaOnLMousePress(pictureBox1.Handle, e.X, e.Y);
 }
Exemple #19
0
        /// <summary>
        /// 主摄像头拍照返回Base64位
        /// </summary>
        /// <param name="file">路径</param>
        /// <returns></returns>
        public String btnCaptureMainBase64_Click(String file)
        {
            if (bOpenMain)
            {
                file = LocalPath + "\\" + file;
                //如果没有目录,则创建目录
                String dir = Path.GetDirectoryName(file);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                //SD.LaSetJpgQuality(mainIndex, 50);
                GpySdImpl.LaSetDPI(mainIndex, 350);

                //Im.Dispose();
                //Bm.Dispose();
                //File.Delete(file);

                //String base64= SD.LaCaptureBase64(mainIndex);

                if (File.Exists(file))
                {
                    File.Delete(file);
                }

                //String file = ("C:\\bcd.jpg");

                GpySdImpl.LaCapture(mainIndex, file);

                //int i = file.LastIndexOf(".");
                //string extension = file.Substring(i + 1);

                //Image Im = Image.FromFile(file);

                ////Bitmap Bm = new Bitmap(file);
                //Bitmap Bm = new Bitmap(Im);

                //MemoryStream m = new MemoryStream();


                ////Image img = this.pictureBox.Image;
                //BinaryFormatter binFormatter = new BinaryFormatter();
                //MemoryStream memStream = new MemoryStream();
                //binFormatter.Serialize(m, Im);
                ////byte[] bytes = memStream.GetBuffer();
                ////string base64 = Convert.ToBase64String(bytes);

                //if (extension == "tif")
                //{
                //    //Bm.Save(m, ImageFormat.Tiff);
                //    Im.Save(m, ImageFormat.Tiff);

                //    Bm.Save("C:\\bcd.jpg", ImageFormat.Tiff);

                //}
                //else if (extension == "jpg")
                //{
                //    //Bm.Save(m, ImageFormat.Jpeg);
                //    Im.Save(m, ImageFormat.Jpeg);

                //    Bm.Save("C:\\bcd.jpg", ImageFormat.Jpeg);
                //}


                //String base64 = SD.LaCaptureBase64(mainIndex);

                //String base64 = Convert.ToBase64String(m.GetBuffer());
                //String base64 = Convert.ToBase64String(m.ToArray());

                //byte[] bytes = null;
                //using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read))
                //{
                //    using (BinaryReader br = new BinaryReader(fs))
                //    {
                //        bytes = br.ReadBytes((int)fs.Length);
                //    }
                //}
                //String base64 = Convert.ToBase64String(bytes);


                //String base64 = SD.LaConvert2Base64(file);

                String base64 = btnConvertBase64_Click(file);

                //SD.AddImageItem(file);//显示

                //Im.Dispose();
                //Bm.Dispose();

                return(base64);
            }
            else
            {
                return(null);
            }
        }
Exemple #20
0
 /// <summary>
 /// 开关自动去背景,默认打开为true,关闭为false
 /// </summary>
 /// <param name="bEnable"></param>
 public void btnEnableDelBack_Click(bool bEnable)
 {
     GpySdImpl.LaEnableDelBack(subIndex, bEnable);
 }
Exemple #21
0
 public GpyUserControl()
 {
     InitializeComponent();
     GpySdImpl.LaInit();
     LocalPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
 }
Exemple #22
0
 /// <summary>
 /// 设置颜色:0--彩色, 1--灰度, 2--黑白
 /// </summary>
 /// <param name="iClrIndex"></param>
 public void btnSetDevColor_Click(int iClrIndex)
 {
     GpySdImpl.LaSetDevColor(mainIndex, iClrIndex);
 }
Exemple #23
0
 /// <summary>
 /// 设置主摄像头压缩比
 /// </summary>
 /// <param name="iQual"></param>
 public void btnSetJpgQualityMain_Click(int iQual)
 {
     GpySdImpl.LaSetJpgQuality(mainIndex, iQual);
 }
Exemple #24
0
 /// <summary>
 /// 设置分辨率
 /// </summary>
 /// <param name="iRes"></param>
 public void btnSetResolution_Click(int iRes)
 {
     GpySdImpl.LaSetResolution(mainIndex, iRes);
 }
Exemple #25
0
 /// <summary>
 /// 设置副摄像头压缩比
 /// </summary>
 /// <param name="iQual"></param>
 public void btnSetJpgQualitySub_Click(int iQual)
 {
     GpySdImpl.LaSetJpgQuality(subIndex, iQual);
 }