How to capture the “same” RGB images for the same scene using EDSDK?

Discussion in 'Digital Photography' started by azuring@gmail.com, Apr 28, 2013.

  1. Guest

    We use EDSDK to control cannon Eos 7D, for taking picture with one fixed object.

    We try to make everything the same, including camera position, aperture, ISO, shutter Speed, focus (manual focusing), no flash lamp, and take picture one after another to make sure everything is not changed. It is expected wecan obtain the close RGB images every time.

    But then we found the JPG images are diffent every time we capture. For example , we calculate the RGB sum of the whole object block (block position is fixed, background are pure dark -- zeros), first time we get RGB == (10000,20000,15000), second time we get (12000,24000,17000), third time we get(9000, 18000, 13000). We know there must be some little variance/noise when capturing pictures. But the RGB values shifted much every time (-15% to 15% difference), this must be not noise ( we guess it must be caused by some auto adjusting setting).

    Why we get the different results? Where do we make mistake?

    We also try to get the raw format image (.CR2) , and then use dcraw.exe to transfer it to PPM or TIFF format, with the same tranforming parameter (we use -v -k 2400 -S 13000 -W -g 2.222 4.5 ). But the image RGB values still shifted much every time.

    Below are some snippet of our code (in C#, some details are ignored).

    Since our task is to calculate the RGB values accurately, so this problem is quite important for us. Thank you very much for your help !

    ############ C# code #########################################


    public void main(){

    EDSDK.EdsInitializeSDK();
    EDSDK.EdsGetCameraList(out cameraList);
    EDSDK.EdsGetChildCount(cameraList, out cameraCount);
    EDSDK.EdsGetChildAtIndex(cameraList, 0, out cam);
    EDSDK.EdsGetDeviceInfo(cam, out deviceInfo);
    EDSDK.EdsSetPropertyEventHandler(cam, EDSDK.PropertyEvent_All, propertyEventHandle, inContext);
    ObjectEventHandle = new EDSDK.EdsObjectEventHandler(ObjectEventCallBack);
    EDSDK.EdsSetObjectEventHandler(cam, EDSDK.ObjectEvent_All, ObjectEventHandle, IntPtr.Zero);
    EDSDK.EdsSetCameraStateEventHandler(cam, EDSDK.StateEvent_All, stateEventHandle, inContext);
    EDSDK.EdsOpenSession(cam);

    EDSDK.EdsSetPropertyData(cam, EDSDK.PropID_SaveTo, 0, 4, (uint)EDSDK.EdsSaveTo.Host);
    EDSDK.EdsSetPropertyData(cam, EDSDK.PropID_ImageQuality, 0, 4, (uint)0x0013ff0f);

    EDSDK.EdsSetPropertyData(cam, EDSDK.PropID_Av, 0, 4, (uint)0x58);
    EDSDK.EdsSetPropertyData(cam, EDSDK.PropID_Tv, 0, 4, (uint)0x6b);
    EDSDK.EdsSetPropertyData(cam, EDSDK.PropID_ISOSpeed, 0, 4, (uint)0x48);

    EDSDK.EdsCapacity capacity = default(EDSDK.EdsCapacity);
    capacity.NumberOfFreeClusters = 0x10000000;
    capacity.BytesPerSector = 0x0200;
    capacity.Reset = 1;
    EDSDK.EdsSetCapacity(cam, capacity);

    EDSDK.EdsSendCommand(cam, EDSDK.CameraCommand_TakePicture, 0);


    }


    public void DownloadImage(String Path, IntPtr DirItem)
    {
    uint Err = 0;

    EDSDK.EdsDirectoryItemInfo DirInfo;

    Err = EDSDK.EdsGetDirectoryItemInfo(DirItem, out DirInfo);
    if (Err != 0) throw new Exception();

    IntPtr Stream;
    Err = EDSDK.EdsCreateFileStream(Path, EDSDK.EdsFileCreateDisposition.CreateAlways, EDSDK.EdsAccess.ReadWrite, out Stream);
    if (Err != 0) throw new Exception();

    Err = EDSDK.EdsDownload(DirItem, DirInfo.Size, Stream);
    if (Err != 0) throw new Exception();

    Err = EDSDK.EdsDownloadComplete(DirItem);
    if (Err != 0) throw new Exception();

    Err = EDSDK.EdsRelease(Stream);
    if (Err != 0) throw new Exception();

    while (!System.IO.File.Exists(Path))
    Thread.Sleep(100);

    }

    public uint ObjectEventCallBack(uint Event, IntPtr Object, IntPtr Context)
    {
    switch (Event)
    {
    case EDSDK.ObjectEvent_DirItemCreated:
    foreach (EDSFileObject File in Results)
    {
    if (File.mFileInfo.isFolder == 0)
    {
    DownloadImage(Filepath, File.mFilePointer);
    }
    }
    }
    break;
    }
    return EDSDKLib.EDSDK.EDS_ERR_OK;
    }
     
    , Apr 28, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Satoshi

    How to capture a scene from mpg

    Satoshi, Feb 21, 2005, in forum: Digital Photography
    Replies:
    3
    Views:
    245
    Jim Waggener
    Feb 21, 2005
  2. 223rem

    Combining multiple exposures of same scene?

    223rem, Mar 9, 2006, in forum: Digital Photography
    Replies:
    16
    Views:
    670
  3. Karelk

    Capture images using PC

    Karelk, Jan 19, 2007, in forum: Digital Photography
    Replies:
    1
    Views:
    266
    Chris Gilbert
    Jan 19, 2007
  4. Morton

    Colorsmart RGB or Adobe RGB?

    Morton, Dec 13, 2007, in forum: Digital Photography
    Replies:
    2
    Views:
    3,832
    Morton
    Dec 14, 2007
  5. Giuen
    Replies:
    0
    Views:
    1,010
    Giuen
    Sep 12, 2008
Loading...

Share This Page