Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);//显示
     }
 }
Ejemplo n.º 4
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);                 //关闭自动纠偏
            }
        }
Ejemplo n.º 5
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);
            }
        }