Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
fp:assig-01 [2021/04/27 17:46] lfa [Helper code] |
fp:assig-01 [2021/05/06 17:32] (current) dmihai [Submission] |
||
---|---|---|---|
Line 41: | Line 41: | ||
2.2. **cropping with a rectangle selection** | 2.2. **cropping with a rectangle selection** | ||
- | * your function should take a rectangle modelled by a ''(Int, Int, Int, Int)'' tuple (the first two ''Int''s are the coordinates of the top-right corner, the next two ''Int''s are the height and width of the rectangle). It should return a new image with the same height and width as the rectangle selection containing the pixels in the image which fall withing the rectangle's area. | + | * your function should take a rectangle modelled by a ''(Int, Int, Int, Int)'' tuple (the first two ''Int''s are the coordinates of the top-left corner, the next two ''Int''s are the height and width of the rectangle). It should return a new image with the same height and width as the rectangle selection containing the pixels in the image which fall withing the rectangle's area. |
2.3. **brightness adjustment** | 2.3. **brightness adjustment** | ||
Line 100: | Line 100: | ||
* for single image transformations (i.e. all except masking), edit line 13. The following example will configure it with a crop of a 50x50 square that starts at coordinates (30, 30): | * for single image transformations (i.e. all except masking), edit line 13. The following example will configure it with a crop of a 50x50 square that starts at coordinates (30, 30): | ||
* <code>myTransform img = crop (30, 30, 80, 80) img</code> | * <code>myTransform img = crop (30, 30, 80, 80) img</code> | ||
- | * for transformations that require to images (just masking), line 16 is relevant; but you can leave it as it is, as there's only one transformation candidate. | + | * for transformations that require two images (just masking), line 16 is relevant; but you can leave it as it is, as there's only one transformation candidate. |
After having edited ''Main.hs'' you can run it; depending on the number of arguments, it will choose an appropriate type of transformation (single/multiple image); it also correctly chooses between greyscale/RGB functions based on the actual filetype. To run the file you need the ''runhaskell'' binary (or ''runghc''; both should come with the haskell platform), then run it from a shell: | After having edited ''Main.hs'' you can run it; depending on the number of arguments, it will choose an appropriate type of transformation (single/multiple image); it also correctly chooses between greyscale/RGB functions based on the actual filetype. To run the file you need the ''runhaskell'' binary (or ''runghc''; both should come with the haskell platform), then run it from a shell: | ||
Line 124: | Line 124: | ||
==== Submission ==== | ==== Submission ==== | ||
- | For submission you should create a zip archive of the two files you modified: ''Greyscale.hs'' and ''Color.hs'' and a ''README''. The ''README'' should contain a succinct high-level presentation of your work. The archive name should be ''LASTNAME_Firstname_FP_A1.zip'' (if you have multiple firstnames, separate them by an underline "_"). Mail it to [[mailto:mihai.dumitru2201@upb.ro|mihai.dumitru2201@upb.ro]]. | + | For submission you should create a zip archive of the three files you modified: ''Common.hs'', ''Greyscale.hs'' and ''Color.hs'' and a ''README''. The ''README'' should contain a succinct high-level presentation of your work. The archive name should be ''LASTNAME_Firstname_FP_A1.zip'' (if you have multiple firstnames, separate them by an underline "_"). Mail it to [[mailto:mihai.dumitru2201@upb.ro|mihai.dumitru2201@upb.ro]]. |