Assert
How do I use Assert
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
131 | Debug.Assert(images.Length == labels.Length, "The number of images should equals the number of labels"); | 1 |
File name: EigenObjectRecognizer.cs
Copy
129 public EigenObjectRecognizer(Image130 {
131 Debug.Assert(images.Length == labels.Length, "The number of images should equals the number of labels");
132 Debug.Assert(eigenDistanceThreshold >= 0.0, "Eigen-distance threshold should always >= 0.0");
133
134 CalcEigenObjects(images, ref termCrit, out _eigenImages, out _avgImage);
135
136 /*
137 _avgImage.SerializationCompressionRatio = 9;
138
139 foreach (Image
140 //Set the compression ration to best compression. The serialized object can therefore save spaces
141 img.SerializationCompressionRatio = 9;
142 */
143
144 _eigenValues = Array.ConvertAll
145 delegate(Image
146 {
147 return new Matrix
148 });
149
150 _labels = labels;
151
152 _eigenDistanceThreshold = eigenDistanceThreshold;
153 }
Assert 95 lượt xem
Gõ tìm kiếm nhanh...