In this case, your job is to develop an application that can enhance a particular yard line on a football field.
Camera
class has
methods for getting the Color
of the grass, for getting
the Color
to use when enhancing the first down line and
the line of scrimmage, and for getting the top
(getTop()
) and bottom (getBot()
) point of
a given yard line. Yard lines are designated by the yard number and
an 'R' or 'L', indicating whether the yard line is to the right or
left of the 50 yard line. So, for example, "48R" indicates the 48
yard line to the right of the 50 yard line.
In addition, the MarkitY
class has the
main()
method for the application. You must not modify
it.
The execution of MarkitY
is controlled with
command line parameters that contain: the name of the file containing the
frame/image, the line of scrimmage, and the first down line.
YardMarker
class that is similar in spirit
to the BillboardMarker
class. It must have a method with the
following signature:
/** * Enhance the given yard line using the given color. That is * "draw" a line that is 19 pixels wide centered * at the given yard line. * * The line that is drawn must only replace pixels that are * similar to the current grass color. * * @param image The original image * @param yardline The yard line to enhance * @param Color The color to use for the enhancement * @return A copy of the image with the yard line enhanced */ public Color[][] enhance(Color[][] image, String yardline, Color line)
java MarkitY field.png 43R 48R
must generate a result like the following:
Color
object using the obvious accessors. These values
will be in the interval [0,255]. The Color
class
has a constructor that must be passed red, green and blue values.
These values, too, must be in the interval [0,255] so care must be taken
when calculating the weighted averages.
This approach yields results like the following:
Modify your enhance()
method so that it uses this approach.
Copyright 2011