Difference between revisions of "ForkLoop Images Assignment"
(→apply) |
|||
Line 10: | Line 10: | ||
==PixelFilters== | ==PixelFilters== | ||
− | + | {| class="mw-collapsible wikitable" | |
+ | !| PixelFilters | ||
+ | |- | ||
+ | | <pre>public class PixelFilters { | ||
private static class HueSettingPixelFilter implements PixelFilter { | private static class HueSettingPixelFilter implements PixelFilter { | ||
private final double hue; | private final double hue; | ||
Line 63: | Line 66: | ||
}; | }; | ||
} | } | ||
− | }</ | + | }</pre>|} |
=Code To Implement= | =Code To Implement= |
Revision as of 04:45, 3 February 2023
Contents
Motivation
We gain experience using a parallel fork loop. Image processing often presents the opportunity for a lot of parallelism. Here we will operate on a single image, making a parallel task for each row.
Background
Revisit the Image Batch Race Condition Exercise's Background section for information on pixels and images.
Code To Investigate
Image Batch Race Condition Exercise
Image Batch Race Condition Code To Investigate
PixelFilters
PixelFilters | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
}
Code To ImplementParallelTaskPerRowImageFilter
applymethod:
To complete this method we must return a new instance of the interface HsvImage. The provided class DefaultHsvImage implements HsvImage so should serve well. Nicely, DefaultHsvImage provides both:
These two constructors match up well with the two different return types of the many incantations of join_fork_loop: where R is the return type of the TaskFunction<T, R> passed to the join_fork_loop. What should the return type from the this TaskFunction be?
Visualization
Testing Your Solution
Pledge, Acknowledgments, Citations
More info about the Honor Pledge |