Results 1 to 6 of 6

Thread: DFK 42BUC03 - PictureBox and SizeMode problem in C#

  1. #1
    Join Date
    Mar 2014
    Posts
    3

    DFK 42BUC03 - PictureBox and SizeMode problem in C#

    Hi, I'm programming in C# using OpenCVSharp wrapper and I have a problem with capturing properly the images from DFK 42BUC03 Camera.

    When I used my programm with Plug&Play WebCam - all were OK, but after implementation of IC Imaging Camera some problems appeared.

    I know that there's a secial library to download for MSVisual which gives icImagingControl, but I need to do all in PictureBoxes.

    When I'm using PistureBoxes I can display live images from Camera but Properties like SizeMode.Zoom or StretchImage doesn't work.

    Is there any idea how to solve this kind of problem?

    I described it here too:

    http://stackoverflow.com/questions/2...-to-picturebox

    If anyone have any idea I would be grateful.

  2. #2
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,864

    Re: DFK 42BUC03 - PictureBox and SizeMode problem in C#

    Hello

    I must say
    Code:
    pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
    works fine for me in
    Code:
          private void icImagingControl1_ImageAvailable(object sender, TIS.Imaging.ICImagingControl.ImageAvailableEventArgs e)
            {
                try
                {
                    TIS.Imaging.ImageBuffer ImgBuffer;
                    ImgBuffer = icImagingControl1.ImageActiveBuffer;
                    ImgBuffer.Lock();
    
                    pictureBox1.Image = ImgBuffer.Bitmap;
    
    
                    ImgBuffer.Unlock();
    
    
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
            }
    Best regards
    Stefan
    IC Imaging Control Support

  3. #3
    Join Date
    Mar 2014
    Posts
    3

    Re: DFK 42BUC03 - PictureBox and SizeMode problem in C#

    It's OK, but as I wrote I have to use only PictureBoxes, because I need IplImage from Camera and ICImageControl gives me BMP.
    IplImage is an object which I can use to Camera calibration, circles recognition (HoughCircles Method) and these methods are implemented in OpenCVsharp.
    That's why I can't use ICImageControl.

    My method to view live from Camera:
    Code:
        private void onlineCAM()
        {
    
                while (true)
                {
                    IplImage img = cap.QueryFrame();
                    img = img.Clone();
    
                    Bitmap bm = BitmapConverter.ToBitmap(img);
    
                    this.pictureBox3.Image = bm;
                    storage.Clear();
                    Thread.Sleep(50);
                }
    
        }

  4. #4
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,864

    Re: DFK 42BUC03 - PictureBox and SizeMode problem in C#

    I am very sorry, I must have missed the IplImage part in your first post. I only saw Picturebox and resizing.

    I would like to point you to ImageBuffer.GetImageData
    http://www.imagingcontrol.com/en_US/...tImageData.htm
    You can pass this pointer to your IplImage structure or, may be better you do a memcpy(). I did this in C++ only, not in C#, therefore, I do not know, how to do this in best way in C#
    Best regards
    Stefan
    IC Imaging Control Support

  5. #5
    Join Date
    Mar 2014
    Posts
    3

    Re: DFK 42BUC03 - PictureBox and SizeMode problem in C#

    I have one more question. I saw that when I'm changing properties about image viewing in IC Capture 2.3 for my Industrial Camera I can see that these settings are saved in my PictureBox with image.
    eg. When I change the resolution that another part of image is viewed in PictureBox but still not Streched.

    Is there any setting in IC Capture 2.3 that can scale my image from camera, allow to resizing, or fit the image to the size of window (because when I'm changing form 1280x960 RGB32 to 640x480 RGB32 the image isn't fitted but just cropped)?

    I think this kind of option could be help.

  6. #6
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,864

    Re: DFK 42BUC03 - PictureBox and SizeMode problem in C#

    Hello James

    If you use resolutions smaller than 2592x1944, then you will see a cropped (part) of the image only. This is intended. Since you already work with a picture box, you can use the System.Drawing.Graphics functions to resize your image to your needs.
    Best regards
    Stefan
    IC Imaging Control Support

Similar Threads

  1. DFK 42BUC03 driver problem
    By kubamm in forum Hardware and Driver
    Replies: 3
    Last Post: May 29, 2013, 09:26:36
  2. Simple Windows Forms-Application with pictureBox and livestream
    By sas in forum IC Imaging Control C++ Class Library
    Replies: 11
    Last Post: August 16, 2010, 17:33:34
  3. Snap image into pictureBox
    By sdecorme in forum IC Imaging Control .NET
    Replies: 5
    Last Post: May 15, 2009, 10:09:38
  4. dotnet picturebox
    By Unregistered in forum IC Imaging Control ActiveX
    Replies: 1
    Last Post: June 24, 2004, 08:11:49
  5. .Net Picturebox Image Property
    By Unregistered in forum IC Imaging Control ActiveX
    Replies: 2
    Last Post: June 8, 2004, 13:16:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •