PDA

View Full Version : IC Imaging Control V3.0.7 Division by zero error



acanicio
November 26, 2009, 10:04:04
Dear Stefan,

I just replaced IC imaging control V3.0.5 by V3.0.7 and have a strange issue.
Now, when I change the framerate of the camera, I sometimes get the error :

"Floating point division by zero"

Here is where this happens :


procedure TFRM_CamPropertyDlg.CBX_FrameratesChange(Sender: TObject);
begin
ICImagingControl.LiveStop;
ICImagingControl.DeviceFrameRate := ICImagingControl.DeviceFramerates[CBX_Framerates.ItemIndex+1];
ICImagingControl.LiveStart;

// I put a break on the line below, but the error happens as soon as ICImagingControl.Livestart is called (the line here above).
If @RefreshRateChangeCB <> nil then
RefreshRateChangeCB(Self.Camera,TmpInt);

end;



I didn't get this with the previous version.
This happens when I change from 15 to 30fps and back. It does not happen with lower FPS...
Do you have a hint of what may be happening ?

Thank you.
Best regards
Axel Canicio

Stefan Geissler
November 27, 2009, 09:56:02
Hi Axel,

this sounds not very good. What camera do you use?

acanicio
November 27, 2009, 20:30:19
Hello Stefan,

I'm using the DMK21AU04.AS

It worked fine before, and still works fine with the ICCapture software.
I'm going to try to go back to version 3.0.5 and see if it works again.

Sunday 29/11/2009
I tried going back to V3.0.5 and the problem remains... I uninstalled everything that has to do with IC imaging control.
I then reinstalled V3.0.5.
Same problem.
I changed my code to the following, thinking that it could be a precision range problem :


procedure TFRM_CamPropertyDlg.CBX_FrameratesChange(Sender: TObject);
Var Framerate : Single;
begin
ICImagingControl.LiveStop;
Framerate := ICImagingControl.DeviceFramerates[CBX_Framerates.ItemIndex+1];
// lower the precision to 2 digits
Framerate := Round(Framerate * 100)/100;
ICImagingControl.DeviceFrameRate := Framerate;
Try
ICImagingControl.LiveStart;
Except
On EZeroDivide do
Begin
Showmessage('Divide by zero error in Livestart');
End;
End;
If @RefreshRateChangeCB <> nil then
RefreshRateChangeCB(Self.Camera,StrToFloat(CBX_Fra merates.Text),CBX_Framerates.Text);
end;


As soon as Livestart is called, the program goes into the exception management block and displays the "Divide by zero error in Livestart" message...
Sorry, I can't see the way to have the message respect the program's indentations...

Best regards
Axel

acanicio
November 29, 2009, 18:01:27
Ok I think I just fixed it, but I don't really know how...

I fooled around with the component's properties.
At a moment, I set and unset the LiveDisplayDefault value to true, and back to false.
When I did this, the LiveDisplayHeight and LiveDisplayWidth respectively set themselves to 480 and 640 (previously 0 and 0).
Logically these values are useful only when the LiveDisplay property is set to false, but I never use this property, on my application, it is always set to false.

Well the result is... that now the error does not show up anymore !!!


Needless to say that this is really very very VERY strange...

I'll try to install again V3.0.7 and see if it behaves the same way.

Thank you.
Best regards
Axel

Stefan Geissler
November 30, 2009, 08:14:28
Axel



Needless to say that this is really very very VERY strange...


This is realy strange.


Framerate := Round(Framerate * 100)/100;

You do not need to round the frame rage. The camera supports only 3.75, 7.5, 15, 30 and 60 fps. If you set a value for Framerate, then the nearest matching frame rate in the camera is set. E.g. Framrate = 50; results in 60 fps.

acanicio
November 30, 2009, 20:32:49
Axel

This is realy strange.

You do not need to round the frame rage. The camera supports only 3.75, 7.5, 15, 30 and 60 fps. If you set a value for Framerate, then the nearest matching frame rate in the camera is set. E.g. Framrate = 50; results in 60 fps.

Yes I know, I usually don't do this, but this time I tried about everything that passed my mind to try to solve the problem.
I just put back the lines of code that I had initially (see my first post), and it keeps working.
I'm keeping my fingers crossed.
I installed again V3.0.7 and it's ok now.

Thank you :-)