Last active
May 10, 2018 12:33
-
-
Save sellmair/a0286b74b3516da1712905f4d9c7e99d to your computer and use it in GitHub Desktop.
Phantom Types in Kotlin: Modelling a Pipeline. Request Inhertiance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is our base request. | |
* It contains the image taken by the camera | |
* The timestamp when it was taken (because it obviously matters) | |
* And some additional settings for the measure algorithm | |
*/ | |
open class Request( | |
val image: Image, | |
val timestamp: Timestamp, | |
val settings: MeasureSettings) | |
/** | |
* This is the special request necessary for detecting basic shapes | |
* in an image. | |
* | |
* This also needs preparedImages, because the vision framework | |
* we are using cannot work with the Image type taken from the camera | |
* directly. | |
* | |
* We also want to provide a scaled version of the prepared image | |
* To prevent every detector to scale the image down by itself (which can be expensive) | |
*/ | |
class ShapeDetectionRequest( | |
val preparedImage: Mat, | |
val preparedScaledImage: Mat, | |
override val image: Image, | |
override val timestamp: Timestamp, | |
override val MeasureSettings): Request | |
/** | |
* This is the special request necessary for detecting basic features | |
* like arms, shoes, faces, etc in an imagge. | |
*/ | |
class FeatureDetectionRequest( | |
val shapes: List<Shape>, | |
val preparedImage: Mat, | |
val preparedScaledImage: Mat, | |
override val image: Image, | |
override val timestamp: Timestamp, | |
override val MeasureSettings): Request | |
/* AND SO ON AND ON AND ON */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment