We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm an italian student! I'm working on a program but I can't create the entire correct code. Can I write the exercise text and ask for help?
Answers
Yes
Best post your code, what you tried and where you are stuck
This is the exercise text:
Purpose of the exercise is to show how you can produce a color image from a picture in black and white. To accomplish this you must perform the following steps, in the following order:
Write the function (ReadImage) that reads an image by offering the user the window for selecting the file that contains it, and the charge in a PImage object. The function has no arguments and returns the result Pimage object.
Define the FalseColor function that transforms an input pixel color in a false color. The function first converts the color to a gray level calculated as the average color: gl = (red + green + blue) / 3 Subsequently, the function converts the gray false color (or pseudocolor) this way: if gl is less than or equal to 80, then the colorFC color components [r g b] equal to [0 0 c] where c = gl * 255/80 if gl is between 80 and 160 the components are [0 255 c] where c = (gl-80) * 255/80 Finally, if gl is between 160 and 255 components are [255 c 255] where c = (gl- 160) * 255/95
Define the function Transform (imageOR, x, y, truck width, height). The Transform function takes as arguments an image (imageOR) and the coordinates of a rectangular region of which x and y are the coordinates of the upper left corner and the width and height are the dimensions. The function must be transformed into false color only pixels included in the specified rectangular region. To do so you must use the FalseColor function.
Define a script that loads an image chosen by the user using the ReadImage function and display it. The user can define a rectangular area by dragging the mouse (after doing a click with the mouse button on left move the mouse while holding the button). That region of the script applies the transformation in false color.
I tried and make just this for now
It's really incomplete and there's something wrong.
Please help me, thanks!