A common task in image-processing applications (ex: when categorizing whether an image was taken outdoors or not) is to compare relative red-green-blue (RGB) components of two of more images.
For this assignment, you are going to create a very simple JavaFX graphical user interface (GUI) class called
ImageRGBAnalyzer
that
1. reads the filename of an image from a GUI
(25 pts)
2. Loads and displays the image on the GUI
(25 pts)
3. Determines its red, green and blue component color percentages*
(15 points)
4. Displays these percentages in a pie-chart format on the GUI**
(25 points)
5. Puts all of these together into a single interface.
(10 points)
*You must use the RGBPC.getRGBPercent method included with this assignment for this task.
**You must use the Arc shape objects we discussed in class for this task. Use red for red, etc.
As stipulated above, the static
getRGBPercent
method included in the
RGBPC
class must be used for #3. It takes as input a JavaFX Image object and returns a three-dimensional array of RGB percentages. For example, an image of a lit fireplace may be expected to produce [80,15,5] or similar as output.
You have full flexibility in creating the GUI as you see fit, but if you’re not certain where to start, here are some recommendations:
i. Tackle the tasks separately before putting them together. Note that for #4 you can always create a pie-chart with fake percentages at first. As a hint, the number
3.6is highly relevant to this task.
ii. Consider modeling your combined GUI on the one shown in screenshots in Blackboard attachments for this assignment (
sampleGUIscreenshots.jpg). The JavaFX UI components utilized in this GUI include a
TextField,
Button,
ImageView,
StackPane, and
GridPane(with the previous four elements being added to the GridPane).
iii. Testing your code with the attached image files should give pie charts with similar portions as those
sampleGUIscreenshots.jpg.
iv. ImageRGBAnalyzer should be launchable as a JavaFX application.