Merge branch 'background-UV' into 'v3'
Use the UV channels only to determine if an area is background or sample Closes #300 See merge request openflexure/openflexure-microscope-server!211
This commit is contained in:
commit
2cffe21727
1 changed files with 5 additions and 2 deletions
|
|
@ -259,9 +259,12 @@ class BackgroundDetectThing(Thing):
|
|||
raise RuntimeError(
|
||||
"Background is not set: you need to calibrate background detection."
|
||||
)
|
||||
# This image is in LUV space. But the brightness (L) often changes as the
|
||||
# height of the sample changes. Hence in the line below we are only using
|
||||
# the UV (colour) channels.
|
||||
return np.all(
|
||||
np.abs(image - np.array(d.means)[np.newaxis, np.newaxis, :])
|
||||
< np.array(d.standard_deviations)[np.newaxis, np.newaxis, :]
|
||||
np.abs(image[:, :, 1:] - np.array(d.means[1:])[np.newaxis, np.newaxis, :])
|
||||
< np.array(d.standard_deviations[1:])[np.newaxis, np.newaxis, :]
|
||||
* self.tolerance,
|
||||
axis=2,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue