PDA

View Full Version : SDK Anyone?


EDad
13th of February 2004 (Fri), 20:59
This may be the wrong place.... but I'll try anyway.

Where can I go to get more information about the Canon SDK? I've downloaded the SDK, read the documentation, but want to find where to go to learn/ask more.

Any programmers lurking here?

Thanks

atleypnorth
14th of February 2004 (Sat), 01:56
yes have used it

MediaMagic
14th of February 2004 (Sat), 13:35
This may be the wrong place.... but I'll try anyway.

Where can I go to get more information about the Canon SDK? I've downloaded the SDK, read the documentation, but want to find where to go to learn/ask more.

Any programmers lurking here?

Thanks


I am a programmer, yes, familiar with C/C++, C#/Java, VisBasic, but I've never looked at the SDK (because the only thing I'm more addicted to than photography is screwing with code). I'm sure that would become yet ANOTHER addictive hobby for me. Okay, I'm convinced, I'll have to take a look at it.

Is there something specific you are trying to accomplish with code? or are you seeking a more in depth general knowledge of the SDK?

David

EDad
14th of February 2004 (Sat), 18:37
David,

I'm really just trying to find out where to go to talk to other programmers about how the SDK functions, what is seen on different cameras, etc.

For example, with a 10D connected, I get really screwy results when I try to determine the supported image sizes (sorry I can't remember the function call -- that's on another computer).

Mike

atleypnorth
15th of February 2004 (Sun), 02:48
If you post the bit of code you are using then someone might be able to
see if there is a problem with it. Most cameras support the basic functions but some of the more advanced remote control functionallity is supported on only some cameras .

Patrick

EDad
15th of February 2004 (Sun), 18:05
If you post the bit of code you are using then someone might be able to
see if there is a problem with it.

Thanks for the offer. I broke out the code to just demonstrate the problem I'm having getting the supported image sizes. Here goes:


Dim hCam As Long
Dim hEnum As Long
Dim uVer As cdVersionInfo
Dim uSourceInfo As cdSourceInfo
Dim uSizeProp As cdImageSizeSpec

'Init SDK
uVer.MajorVersion = 6
uVer.MinorVersion = 1
uVer.Size = Len(uVer)
Call CDStartSDK(uVer, 0&)

'connect to camera
Call CDEnumDeviceReset(1, hEnum)
Call CDEnumDeviceNext(hEnum, uSourceInfo)
Call CDEnumDeviceRelease(hEnum)
Call CDOpenSource(uSourceInfo, hCam)

'image size properties
Call CDEnumSupportedImageSizeReset(hCam, 0&, hEnum)

Do While CDEnumSupportedImageSizeNext(hEnum, uSizeProp) = cdOK
Debug.Print Left(uSizeProp.SizeName, InStr(1, uSizeProp.SizeName, Chr(0)) - 1); " "; Format(uSizeProp.Size.Width, "0,000") & " x " & Format(uSizeProp.Size.Height, "0,000")
Loop

Call CDEnumSupportedImageSizeRelease(hEnum)
Call CDFinishSDK


Here's the output I get:
rge 134,217,728 x 1,632,370,688
ddle 89,128,960 x 1,766,653,952
all 67,108,864 x 1,834,156,032

The size names might be ok.... but the width x height values are off.

Any help is appreciated. I suspect I'm just being stupid :oops:

theoldmoose
16th of February 2004 (Mon), 12:06
Just off the top of my head (and I haven't tinkered with the SDK myself, so this is just a guess):

Could this be 'endian' problems? In other words, the byte order of the 32-bit or 16-bit values coming from the camera may not be in the same order as VB is supposing, here.

May be completely off-base, but it might get you thinking about something in that area, that might help. Try inspecting the byte values of the numbers you are getting, and see if something jumps out at you. May be even a structure alignment problem. Do you need to 'pack' your structures, here, so VB is not inserting gratuitous bytes to pad members to the nearest word boundary?

atleypnorth
16th of February 2004 (Mon), 15:59
Not done that much VB for a while so cant see anything obvious ...
but the names do look wrong ...
to me looks like something not being dereference from a pointer, but will
need to check out some VB to remind myself how it works!

Pretty sure it isnt a little endian/big endian problem since never seen it before in the SDK and would expect the SDK to handle that

EDad
16th of February 2004 (Mon), 20:59
Here's the output I get:
rge 134,217,728 x 1,632,370,688
ddle 89,128,960 x 1,766,653,952
all 67,108,864 x 1,834,156,032

Thanks all for looking. I don't think it's an big/little endian or dereferencing problem though.

Here's what I've figured out since then:

The SDK is returning the values in the high-order bytes (of course, not documented). So the values translate this way:

rge 134,217,728 x 1,632,370,688
Width 0000100000000000 0000000000000000 2048 <--high order bytes result
Heigh 0110000101001100 0000000000000000 24908

ddle 89,128,960 x 1,766,653,952
Width 0000010101010000 0000000000000000 1360
Heigh 0110100101001101 0000000000000000 26957

all 67,108,864 x 1,834,156,032
Width 0000010000000000 0000000000000000 1024
Heigh 0110110101010011 0000000000000000 27987

I have no idea what to make of the height values. Those high-order bytes seem meaningless.

Whaler
16th of February 2004 (Mon), 21:03
That is why I don't mess with code.

EDad
16th of February 2004 (Mon), 21:08
:lol:

MediaMagic
16th of February 2004 (Mon), 21:38
Here's the output I get:
rge 134,217,728 x 1,632,370,688
ddle 89,128,960 x 1,766,653,952
all 67,108,864 x 1,834,156,032

Thanks all for looking. I don't think it's an big/little endian or dereferencing problem though.

Here's what I've figured out since then:

The SDK is returning the values in the high-order bytes (of course, not documented). So the values translate this way:

rge 134,217,728 x 1,632,370,688
Width 0000100000000000 0000000000000000 2048 <--high order bytes result
Heigh 0110000101001100 0000000000000000 24908

ddle 89,128,960 x 1,766,653,952
Width 0000010101010000 0000000000000000 1360
Heigh 0110100101001101 0000000000000000 26957

all 67,108,864 x 1,834,156,032
Width 0000010000000000 0000000000000000 1024
Heigh 0110110101010011 0000000000000000 27987

I have no idea what to make of the height values. Those high-order bytes seem meaningless.

Hey Edad, I agree, they do seem meaningless, but obviously there must be a method to the madness. It can't be a pointer dereference in VB6 (and even if it were possible, a deref problem would most likely cause the output to be in HEX, or garbage characters). There is no -> or (*) equivalent for dereference as it's not part of the language. Memory can be directly referenced by arrays (equivalent to pointers for all intents and purposes) but that's not the case here.

Nothing jumps out as obvious syntactical errors to me either. Let me get that SDK and documentation downloaded and look through it. Maybe we'll both learn some new goodies outta this.

David

atleypnorth
17th of February 2004 (Tue), 06:57
Are you sure the definition of cdImageSizeSpec and associated structures are correct ?

atleypnorth
17th of February 2004 (Tue), 07:08
answering myself here i know but ...

in the VB files in the demo it defines the following ...
'/* cdImageSizeSpec */
Type cdImageSizeSpec
ImageSize As Long '/* Size */
Size As cdSize '/* Image width and height. */
SizeName As String * 64 '/* Nickname */
End Type

In the other definitions (C/C++ and Delphi) the ImageSize member is
a 16 bit number - isnt a Long in VB 32 bits ???
So this should be ?

'/* cdImageSizeSpec */
Type cdImageSizeSpec
ImageSize As Int '/* Size */
Size As cdSize '/* Image width and height. */
SizeName As String * 64 '/* Nickname */
End Type

EDad
17th of February 2004 (Tue), 19:29
I am humbled in your presence....... :) nice pickup!

With a little pointer trickery; it now reads:

Large 3072 x 2048
Middle 2048 x 1360
Small 1536 x 1024

Thanks again :D :D

MediaMagic
17th of February 2004 (Tue), 20:36
answering myself here i know but ...

in the VB files in the demo it defines the following ...
'/* cdImageSizeSpec */
Type cdImageSizeSpec
ImageSize As Long '/* Size */
Size As cdSize '/* Image width and height. */
SizeName As String * 64 '/* Nickname */
End Type

In the other definitions (C/C++ and Delphi) the ImageSize member is
a 16 bit number - isnt a Long in VB 32 bits ???
So this should be ?

'/* cdImageSizeSpec */
Type cdImageSizeSpec
ImageSize As Int '/* Size */
Size As cdSize '/* Image width and height. */
SizeName As String * 64 '/* Nickname */
End Type


Hey HEY! nice catch!

I haven't been able to download the SDK as of yet, still waiting for some kind of "approval" from Canon. Looks like it'll be fun to jump into.

Adil Abdulhadi
1st of October 2005 (Sat), 01:26
Hi Edad,

Could you please send me a copy of SDK.

Thanks
amaxco@hotmail.com