-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a __main__ self-test configured with a json file #1134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me, ca you bump our dev version up by one?
|
||
|
||
|
||
def imgTransformListFromJson(transforms_config): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comment. Camelcase should preferably be replaced by underscore concatenation for python functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
|
||
|
||
|
||
def loadImgTransformJson(filepath): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
- the __main__ self-test can load an image from a file or use the video stream from a camera - It takes the path to a json file that specifies a list of image transforms, there order and their arguments - functions have been added to load and parse the json file and use it to construct the transform pipeline. - The transform pipeline is implemented with a run() method that applies the transforms in order. - Comments in the code document the json file format.
810f92f
to
5d2a841
Compare
- no other functional changes, just renaming
This should be merged after PR #1133
add a
__main__
self-test configured with a json fileI created this because I found bugs in the image transformations when I tried to create a chain of them. I needed a test where I could try many combinations easily, so I created a function to create a image transform pipeline from a json file and created the
__main__
to use it.You provide a json file that specifies a transformation pipeline and configures either an single image to be loaded or a camera to be used. The image transformation pipeline is constructed and applied the configured image source and shown in an opencv window.
This json specifies a pipeline that applies canny edge detection to the image.
Here the "BLUR" and "CANNY" transforms are using default parameters, so the argument object is empty. The "CROP" transform is supplied with a argument object that specifies all named parameters and their values. The color conversion transforms "RGB2GRAY" and "GRAY2RGB" do not have arguments so no argument object is supplied.
If it was in a json file named
canny_pipeline.json
inpi
home folder the usage would be: