added additional comments

This commit is contained in:
Russell Stanley 2022-01-12 12:25:58 +10:30
parent 74c258cfb8
commit cf526de012
2 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,5 @@
//go:build !ignore
// +build !ignore
//go:build !nocv
// +build !nocv
/*
DESCRIPTION

View File

@ -1,3 +1,6 @@
//go:build !nocv
// +build !nocv
/*
DESCRIPTION
Testing functions for the turbidity sensor using images from
@ -36,11 +39,13 @@ import (
)
const (
nImages = 13 // Number of images to test. (Max 13)
nSamples = 10 // Number of samples for each image. (Max 10)
nImages = 10 // Number of images to test. (Max 13)
nSamples = 1 // Number of samples for each image. (Max 10)
increment = 2.5 // Increment of the turbidity level.
)
// TestImages will read a library of test images and calculate the sharpness and contrast scores.
// A plot of the results will be generated and stored in the plots directory.
func TestImages(t *testing.T) {
const (
k1, k2 = 8, 8
@ -63,12 +68,12 @@ func TestImages(t *testing.T) {
ts, err := NewTurbiditySensor(template, standard, k1, k2, filterSize, scale, alpha)
if err != nil {
t.Fatal("could not create turbidity sensor: %w", err)
t.Fatalf("could not create turbidity sensor: %v", err)
}
results, err := NewResults(nImages)
if err != nil {
t.Fatal("could not create results: %w", err)
t.Fatalf("could not create results: %v", err)
}
// Score each image by calculating the average score from camera burst.
@ -92,6 +97,7 @@ func TestImages(t *testing.T) {
t.Logf("Contrast: %v", results.Contrast)
}
// plotResults plots sharpness and contrast scores against the level of almond milk in the container
func plotResults(x, sharpness, contrast []float64) error {
err := plotToFile(
"Results",