Exemplo n.º 1
0
 private void Camera_ImageReady(NikonDevice sender, NikonImage image)
 {
     Logger.Debug("Image ready");
     _memoryStream = new MemoryStream(image.Buffer);
     Logger.Debug("Setting Download Exposure Task to complete");
     _downloadExposure.TrySetResult(null);
 }
Exemplo n.º 2
0
 private void Camera_ImageReady(NikonDevice sender, NikonImage image)
 {
     Logger.WriteTraceMessage("Image ready");
     Save(image.Buffer, "image" + ((image.Type == NikonImageType.Jpeg) ? ".jpg" : ".nef"));
     Logger.WriteTraceMessage("Setting Download Exposure Taks to complete");
     _downloadExposure.TrySetResult(null);
 }
        void device_ImageReady(NikonDevice sender, NikonImage image)
        {
            if (single_path_tb.Text == string.Empty)
            {
                MessageBox.Show("Select save path");
                return;
            }



            string path = single_path_tb.Text + page_no_lbl.Text + ".jpg";

            if (click_no == 2)
            {
                transfre_to_storage(path, image);
            }
            else
            {
                using (FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    stream.Write(image.Buffer, 0, image.Buffer.Length);
                }
            }
            LoadImageSync_forStrip(single_path_tb.Text + page_no_lbl.Text + ".jpg", page_no_lbl.Text);
            if (page_in_range((Convert.ToDecimal(page_no_lbl.Text) + 1).ToString()))
            {
                page_no_lbl.Text = (Convert.ToDecimal(page_no_lbl.Text) + 1).ToString();
            }
            else
            {
                MessageBox.Show("أخر صفحة فى المهمة");
            }
        }
Exemplo n.º 4
0
 private void DeviceImageReady(NikonDevice sender, NikonImage image)
 {
     Console.WriteLine("Immagine Ricevuta!");
     if (SaveToPc)
     {
         SaveToFile(image.Buffer);
     }
     OnReceived(image);
 }
Exemplo n.º 5
0
        void _device_ImageReady(NikonDevice sender, NikonImage image)
        {
            // Save captured image to disk
            string filename = "image" + ((image.Type == NikonImageType.Jpeg) ? ".jpg" : ".nef");

            using (FileStream s = new FileStream(filename, FileMode.Create, FileAccess.Write))
            {
                s.Write(image.Buffer, 0, image.Buffer.Length);
            }
        }
Exemplo n.º 6
0
        void _device_ImageReady(NikonDevice sender, NikonImage image)
        {
            string dts      = DateTime.Now.ToString("HHmmss");
            string filename = string.Format("{0}_image{1}", dts, ((image.Type == NikonImageType.Jpeg) ? ".jpg" : ".nef"));

            Console.WriteLine("save {0}", filename);
            // Save captured image to disk
            //string filename = "image" + ((image.Type == NikonImageType.Jpeg) ? ".jpg" : ".nef");

            using (FileStream s = new FileStream(filename, FileMode.Create, FileAccess.Write))
            {
                s.Write(image.Buffer, 0, image.Buffer.Length);
            }
        }
Exemplo n.º 7
0
        void device_ImageReady(NikonDevice sender, NikonImage image)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = (image.Type == NikonImageType.Jpeg) ?
                            "Jpeg Image (*.jpg)|*.jpg" :
                            "Nikon NEF (*.nef)|*.nef";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                using (FileStream stream = new FileStream(dialog.FileName, FileMode.Create, FileAccess.Write))
                {
                    stream.Write(image.Buffer, 0, image.Buffer.Length);
                }
            }
        }
Exemplo n.º 8
0
 private void device_ImageReady(NikonDevice sender, NikonImage image)
 {
     Console.WriteLine("Image Ready");
     photostrip.Push(image);
     //fill dat strip
     LiveImage.Source = photostrip.LoadWindowsControlImage(image.Buffer);
     if (photostrip.Pictures.Count() != photostrip.Max)
     {
         TakePicture();
     }
     else
     {
         photostrip.DrawStrip();
     }
 }
Exemplo n.º 9
0
 public Boolean Push(NikonImage image)
 {
     if (Pictures.Count >= Max)
     {
         return(false);
     }
     Pictures.Add(new System.Windows.Controls.Image {
         Source = LoadWindowsControlImage(image.Buffer)
     });
     PicturesWithDataList.Add(new PicturesWithData()
     {
         Name = image.Number.ToString(), Picture = byteArrayToBitmap(image.Buffer)
     });
     return(true);
 }
Exemplo n.º 10
0
        void device_ImageReady(NikonDevice sender, NikonImage image)
        {
            //save preview
            if (image.Type == NikonImageType.Jpeg)
            {
                using (FileStream stream = new FileStream(temppath, FileMode.Create, FileAccess.Write))
                {
                    stream.Write(image.Buffer, 0, image.Buffer.Length);
                }
                //preview the jpeg image
                pictureBox1.ImageLocation = temppath;
                pictureBox1.SizeMode      = PictureBoxSizeMode.StretchImage;
            }

            if (image.Type == NikonImageType.Raw)
            {
                bool saveImage = false;
                if (timeLapseActive)
                {
                    saveImage = true;    //want to automatically save timelapse photos so message box doesn't appear every time
                    timelapseAppender++; //append to keep track and avoid overwrite
                    savePath = "timelapse-" + timelapseAppender.ToString();
                }
                //prompt to save image if not timelapse
                else
                {
                    if (MessageBox.Show("Would you like to save this image?", "caption", MessageBoxButtons.YesNo)
                        == DialogResult.Yes)
                    {
                        saveImage = true;
                        captureAppender++; //append to keep track and avoid overwrite
                        savePath = "capture-" + captureAppender.ToString();
                    }
                }
                if (saveImage == true)
                {
                    //set savepath
                    string currentPath = rawpath + savePath + ((image.Type == NikonImageType.Raw) ? ".NEF" : ".jpg");
                    //save photo
                    using (FileStream stream = new FileStream(currentPath, FileMode.Create, FileAccess.Write))
                    {
                        stream.Write(image.Buffer, 0, image.Buffer.Length);
                    }
                }
            }
            string elapseTime = timer.Elapsed.TotalSeconds.ToString(); //for seeing how long this took since capture method was fired
            // MessageBox.Show(String.Format(@"Time it took to process {0}, was {1} seconds", image.Type.ToString(), elapseTime));
        }
        void transfre_to_storage(string path, NikonImage image)
        {
            /////// need to enhance
            using (FileStream stream = new FileStream("1.jpg", FileMode.Create, FileAccess.Write))
            {
                stream.Write(image.Buffer, 0, image.Buffer.Length);
            }

            Bitmap mybitmap = new Bitmap("1" + ".jpg");


            Bitmap mybitmap2 = new Bitmap(get_crop_pict(mybitmap));

            SaveJpeg(path, mybitmap2, 50);

            mybitmap.Dispose();
        }
Exemplo n.º 12
0
 void device_ImageReady(NikonDevice sender, NikonImage image)
 {
     if (ClosingTimerStarted)
     {
         closingTimer.Elapsed -= new ElapsedEventHandler(CloseForm);
         closingTimer.Stop();
         ClosingTimerStarted = false;
     }
     closingTimer.Elapsed += new ElapsedEventHandler(CloseForm);
     closingTimer.Start();
     ClosingTimerStarted = true;
     pictureBox1.Invoke((MethodInvoker) delegate
     {
         pictureBox1.Image = ImageProcessing.Properties.Resources.bekleme;
         pictureBox2.Image = null;
     });
     Image.PersonImage = new Bitmap(new MemoryStream(image.Buffer));
 }
Exemplo n.º 13
0
 protected virtual void OnReceived(NikonImage img)
 {
     Received?.Invoke(img);
 }
Exemplo n.º 14
0
 private void OpenReceivedWindow(NikonImage img)
 {
 }
Exemplo n.º 15
0
        /*
         * void liveViewTimer_Tick(object sender, EventArgs e)
         * {
         *  // Get live view image
         *  NikonLiveViewImage image = null;
         *
         *  try
         *  {
         *      image = device.GetLiveViewImage();
         *  }
         *  catch (NikonException)
         *  {
         *      liveViewTimer.Stop();
         *  }
         *
         *  // Set live view image on picture box
         *  if (image != null)
         *  {
         *      MemoryStream stream = new MemoryStream(image.JpegBuffer);
         *      pictureBox.Image = Image.FromStream(stream);
         *  }
         * }
         */

        void device_ImageReady(NikonDevice sender, NikonImage image)
        {
            string image2save = string.Format("{0}_{1}.jpg", dt, sender.DeviceID);

            Console.WriteLine("save ... {0}", image2save);

            string imageFolder = tbFilePath.Text;

            using (FileStream stream = new FileStream(Path.Combine(imageFolder, image2save), FileMode.Create, FileAccess.Write))
            {
                stream.Write(image.Buffer, 0, image.Buffer.Length);
            }

            string fileImg1 = Path.Combine(imageFolder, string.Format("{0}_{1}.jpg", dt, 1)),
                   fileImg2 = Path.Combine(imageFolder, string.Format("{0}_{1}.jpg", dt, 2)),
                   fileImg3 = Path.Combine(imageFolder, string.Format("{0}_both.jpg", dt));

            tbOutput.Text = fileImg3;

            Image  img1 = null, img2 = null;
            Bitmap img3;

            if (File.Exists(fileImg1) && File.Exists(fileImg2))
            {
                img1 = Image.FromFile(fileImg1);
                img2 = Image.FromFile(fileImg2);
            }
            else if (File.Exists(fileImg1))
            {
                img1 = Image.FromFile(fileImg1);
                img2 = img1;
            }
            else if (File.Exists(fileImg2))
            {
                img2 = Image.FromFile(fileImg2);
                img1 = img2;
            }

            if (File.Exists(fileImg1) || File.Exists(fileImg2))
            {
                int width  = img1.Width + img2.Width;
                int height = Math.Max(img1.Height, img2.Height);

                Console.WriteLine("{0},{1}, {2},{3}", img1.Width, img1.Height, width, height);

                img3 = new Bitmap(width, height);
                Graphics g = Graphics.FromImage(img3);

                g.Clear(Color.Yellow);
                g.DrawImage(img1, 0, 0, img1.Width, img1.Height);
                g.DrawImage(img2, img1.Width, 0, img2.Width, img2.Height);

                g.Dispose();
                img1.Dispose();
                img2.Dispose();

                img3.Save(fileImg3, System.Drawing.Imaging.ImageFormat.Jpeg);
                //img3.Dispose();
                pictureBox.Image = img3;
            }


            // Signal the the capture completed
            //_waitForCaptureComplete.Set();

            /*
             * SaveFileDialog dialog = new SaveFileDialog();
             *
             * dialog.Filter = (image.Type == NikonImageType.Jpeg) ?
             *  "Jpeg Image (*.jpg)|*.jpg" :
             *  "Nikon NEF (*.nef)|*.nef";
             *
             * if (dialog.ShowDialog() == DialogResult.OK)
             * {
             *  using (FileStream stream = new FileStream(dialog.FileName, FileMode.Create, FileAccess.Write))
             *  {
             *      stream.Write(image.Buffer, 0, image.Buffer.Length);
             *  }
             * }
             */
        }
Exemplo n.º 16
0
 public PreviewWindow(NikonImage img)
 {
     InitializeComponent();
 }
Exemplo n.º 17
0
 void device_ImageReady(NikonDevice sender, NikonImage image)
 {
     Save(image.Buffer, "image" + ((image.Type == NikonImageType.Jpeg) ? ".jpg" : ".nef"));
 }