{"id":19083263,"url":"https://github.com/psingh12354/imagetransforming","last_synced_at":"2025-06-12T21:04:31.209Z","repository":{"id":185587945,"uuid":"229587820","full_name":"Psingh12354/ImageTransforming","owner":"Psingh12354","description":"Image Transforming Project contain illnify watermark spotlight greyscale","archived":false,"fork":false,"pushed_at":"2020-07-23T08:18:08.000Z","size":8962,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T20:43:57.319Z","etag":null,"topics":["coursera","cpp","final-project","image-transform","imageprocessing","objectorientedprogramming"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Psingh12354.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-22T15:20:27.000Z","updated_at":"2020-10-01T07:15:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"50d75f77-0045-4a88-9e0e-6796360c8966","html_url":"https://github.com/Psingh12354/ImageTransforming","commit_stats":null,"previous_names":["psingh12354/imagetransforming"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FImageTransforming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FImageTransforming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FImageTransforming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Psingh12354%2FImageTransforming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Psingh12354","download_url":"https://codeload.github.com/Psingh12354/ImageTransforming/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240133141,"owners_count":19752993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coursera","cpp","final-project","image-transform","imageprocessing","objectorientedprogramming"],"created_at":"2024-11-09T02:46:45.609Z","updated_at":"2025-02-22T06:22:21.339Z","avatar_url":"https://github.com/Psingh12354.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eObject-Oriented Data Structures in C++\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"https://d3c33hcgiwev3.cloudfront.net/tX6cOkWjEemnrA4AsaAhFA_bffc6c3e72284eda9820d7fca7640b46_image-transform-instructions_20190313.pdf?Expires=1595376000\u0026Signature=dB~vI0AIX0Urw9ZNkwTxE7jd3RQXLkkI0sSLRa2iK8k2XZENBTAfuUVPtrBMYIP1vjUE9GaK1aJUCIWB92-tGDHNEfXUH6SgddX-yO7V3m56iEEQ-aQjeg3iYPY6bxNr4I0Z17jCNRJgw2OTaFfA83-Qk9PAr~j9UHPmKZyUcEI_\u0026Key-Pair-Id=APKAJLTNE6QMUY6HBC5A\"\u003eClick\u003c/a\u003e here to get complete question\u003c/p\u003e\n\n# Solution\n\n\u003cp\u003eClick on the \u003ca href=\"https://github.com/Psingh12354/Object-Oriented-Data-Structures-in-C-/tree/master/Project \"\u003e link \u003c/a\u003e to get your solutions\u003c/p\u003e\n\n\u003cp\u003e \u003cb\u003e\u003ci\u003e\u003cu\u003eSource Code\u003c/b\u003e\u003c/i\u003e\u003c/u\u003e\u003c/p\u003e\n\n```\n#include \u003ciostream\u003e\n#include \u003ccmath\u003e\n#include \u003ccstdlib\u003e\n\n#include \"uiuc/PNG.h\"\n#include \"uiuc/HSLAPixel.h\"\n#include \"ImageTransform.h\"\n\n/* ******************\n(Begin multi-line comment...)\nWrite your name and email address in the comment space here:\nName:Priyanshu Singh\nEmail:priyanshu.7068183126@gmail.com\n(...end multi-line comment.)\n******************** */\n\nusing uiuc::PNG;\nusing uiuc::HSLAPixel;\n/**\n * Returns an image that has been transformed to grayscale.\n *\n * The saturation of every pixel is set to 0, removing any color.\n *\n * @return The grayscale image.\n */\nPNG grayscale(PNG image) {\n  /// This function is already written for you so you can see how to\n  /// interact with our PNG class.\n  for (unsigned x = 0; x \u003c image.width(); x++) {\n    for (unsigned y = 0; y \u003c image.height(); y++) {\n      HSLAPixel \u0026 pixel = image.getPixel(x, y);\n\n      // `pixel` is a reference to the memory stored inside of the PNG `image`,\n      // which means you're changing the image directly. No need to `set`\n      // the pixel since you're directly changing the memory of the image.\n      pixel.s = 0;\n    }\n  }\n\n  return image;\n}\n\n\n\n/**\n * Returns an image with a spotlight centered at (`centerX`, `centerY`).\n *\n * A spotlight adjusts the luminance of a pixel based on the distance the pixel\n * is away from the center by decreasing the luminance by 0.5% per 1 pixel euclidean\n * distance away from the center.\n *\n * For example, a pixel 3 pixels above and 4 pixels to the right of the center\n * is a total of `sqrt((3 * 3) + (4 * 4)) = sqrt(25) = 5` pixels away and\n * its luminance is decreased by 2.5% (0.975x its original value).  At a\n * distance over 160 pixels away, the luminance will always decreased by 80%.\n * \n * The modified PNG is then returned.\n *\n * @param image A PNG object which holds the image data to be modified.\n * @param centerX The center x coordinate of the crosshair which is to be drawn.\n * @param centerY The center y coordinate of the crosshair which is to be drawn.\n *\n * @return The image with a spotlight.\n */\n PNG createSpotlight(PNG image, int centerX, int centerY) {\n\n   for (unsigned x = 0; x \u003c image.width(); x++) {\n     for (unsigned y = 0; y \u003c image.height(); y++) {\n       HSLAPixel \u0026 pixel = image.getPixel(x, y);\n       double distance = sqrt( (x - centerX) * (x - centerX) + (y - centerY) * (y - centerY));\n       if (distance \u003c 160) {\n         double keep = 1 - 0.5 * distance / 100;\n         pixel.l = pixel.l * keep;\n       } else {\n         pixel.l = pixel.l * 0.2;\n       }\n     }\n   }\n\n   return image;\n\n }\n \n\n/**\n * Returns a image transformed to Illini colors.\n *\n * The hue of every pixel is set to the a hue value of either orange or\n * blue, based on if the pixel's hue value is closer to orange than blue.\n *\n * @param image A PNG object which holds the image data to be modified.\n *\n * @return The illinify'd image.\n**/\nPNG illinify(PNG image) {\n  int illini_orange_hue = 11;\n  int illini_blue_hue = 216;\n\n  for (unsigned x = 0; x \u003c image.width(); x++) {\n    for (unsigned y = 0; y \u003c image.height(); y++) {\n\n      HSLAPixel \u0026 pixel = image.getPixel(x, y);\n\n      if (pixel.h \u003c illini_blue_hue \u0026\u0026 pixel.h \u003e illini_orange_hue) {\n\n        if ( illini_blue_hue - pixel.h \u003c pixel.h - illini_orange_hue ) {\n          pixel.h = illini_blue_hue;\n        } else {\n          pixel.h = illini_orange_hue;\n        }\n      }\n\n      else if (pixel.h \u003c 360 \u0026\u0026 pixel.h \u003e illini_blue_hue) {\n        int dist_blue = pixel.h - illini_blue_hue;\n        int dist_orge = 360 - pixel.h + illini_orange_hue;\n\n        if (dist_blue \u003c dist_orge) {\n          pixel.h = illini_blue_hue;\n        } else {\n          pixel.h = illini_orange_hue;\n        }\n      }\n\n      else {\n        pixel.h = illini_orange_hue;\n      }\n\n    }\n  }\n\n  return image;\n}\n \n/**\n* Returns an immge that has been watermarked by another image.\n*\n* The luminance of every pixel of the second image is checked, if that\n* pixel's luminance is 1 (100%), then the pixel at the same location on\n* the first image has its luminance increased by 0.2.\n*\n* @param firstImage  The first of the two PNGs, which is the base image.\n* @param secondImage The second of the two PNGs, which acts as the stencil.\n*\n* @return The watermarked image.\n*/\nPNG watermark(PNG firstImage, PNG secondImage) {\n\n  for (unsigned x = 0; x \u003c firstImage.width(); x++) {\n    for (unsigned y = 0; y \u003c firstImage.height(); y++) {\n      HSLAPixel \u0026 pixelFirst = firstImage.getPixel(x, y);\n      HSLAPixel \u0026 pixelSecond = secondImage.getPixel(x, y);\n\n      if (pixelSecond.l == 1) {\n        if (pixelFirst.l + 0.2 \u003c= 1) {\n          pixelFirst.l = pixelFirst.l + 0.2;\n        } else {\n          pixelFirst.l = 1;\n        }\n      }\n\n    }\n  }\n\n  return firstImage;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsingh12354%2Fimagetransforming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsingh12354%2Fimagetransforming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsingh12354%2Fimagetransforming/lists"}