04-20-2007 03:46 AM
Txs.
Nuno
04-23-2007 04:47 AM
04-24-2007 02:35 AM
Good morning!
The code I was implementing is something like this:
CalibrationGridOptions.GridDescriptor.Unit = CWIMAQCalibrationUnits.cwimaqCalUnitMillimeter;
CalibrationGridOptions.GridDescriptor.XStep = float.Parse(txtSpacing.Text);
CalibrationGridOptions.GridDescriptor.YStep = float.Parse(txtSpacing.Text);
CalibrationGridOptions.ThresholdRange.Initialize(0, float.Parse(txtThreshold.Text));
LearnCalibrationOptions.CalibrationMethod = CWIMAQCalibrationMethods.cwimaqNonlinearCalibration;
LearnCalibrationOptions.CorrectionRegionMode = CWIMAQCorrectionRegionModes.cwimaqFullImage;
LearnCalibrationOptions.CorrectionScalingMode = CWIMAQCorrectionScalingModes.cwimaqScaleToPreserveArea;
LearnCalibrationOptions.LearnCorrectionTable = true;
LearnCalibrationOptions.LearnErrorMap = false;
CWIMAQRegions regions = new CWIMAQRegions();
regions.AddRectangle(Vision.MakeRectangle(0, 0, CalibrationTemplate.Width, CalibrationTemplate.Height));
{
NationalInstruments.CWIMAQControls.
CWIMAQVision testtt = new CWIMAQVision();NationalInstruments.CWIMAQControls.
CWIMAQImage testimage = new CWIMAQImage();testimage.SetSize(640, 480);
testimage.ArrayToImage(byBuffer);
testtt.LearnCalibrationGrid(testimage, CalibrationGridOptions, LearnCalibrationOptions,
ref QualityScore, regions);}
Where bybuffer is a byte[640,480] that holds the data of the image. I don't know if I'm missing any initialization that can be needed, but I've looked to the documentation and I can't find anything about it!
I'm using Visual Studio .NET 2005, Framework 2.0, Windows XP and the NI Vision 8.2.
Thanks for your support!
Nuno Mendonça
04-25-2007 06:49 AM
Hi Nuno,
First of all keep in mind that you have to specify all the following attributes in a calibration:
* Specify grid calibration
* Specify dot image: It is the image acquired in your condition replaced by the dot image
* Specify what kind of calibration it is (non linear distorsion in your case)
* Specify the treshold level to separate the dots of the grid from the background of the image
* Specify the space between the dots (dx and dy and yhe units)
* You also have to specify a coordinate system.
I am almost sure that you don't have use all this attributes. So send your project i will check!
Is the error appears during the compilation or when you are executing your code? Do you have tested a simple calibration instead?
Thanks
Kamal
NI France