国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代做MP1: Image Transform、C++語言編程代寫

時間:2024-07-19  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



MP1: Image Transform
Object-Oriented Data Structures in C++ — Week 4
University of Illinois
Introduction
By now you've had a chance to learn about basic program structure, classes, and functions in C++. You've also 
had a chance to try compiling a few programs and experimenting on the command line. Now it's time to try out 
a more free-form coding project in your IDE. At the University of Illinois, programming assignments are fondly
referred to as MPs, although there's some debate about whether that stands for "machine-processed" or 
"machine problem." Perhaps a reminder of the days when students had to work out programs on paper and 
submit them on punch cards for batch processing by a mainframe in a separate building. You could say this is 
your MP1. Coincidentally, you might also prefer to use the Cloud9 IDE to work on your assignment.
In this assignment, you will begin with foundational work that will be used for several future assignments in 
this course. Specifically, in Part 1 you will create a simple C++ class that represents a colored pixel; you are 
also provided with a PNG image class that encapsulates the loading and saving of image files. (You do not need 
to implement the PNG class yourself, but you'll find it enlightening to study the code provided.) In Part 2, you 
will use the pixel and PNG classes from Part 1 to transform an image in several different ways.
C++ Environment Setup
Provided with these instructions is a zip file, image-transform-given-ffles.zip. This file contains everything you
need to get started. However, you need to have your IDE or compiler and terminal pre-configured to begin 
work. If you've been following the previous reading lessons, you should already have access to a Linuxcompatible
 C++ work environment regardless of what your operating system is. If not, please go back and 
check out the readings!
Supposing that you are trying out the Cloud9 IDE, we'll show you how to load the files into the workspace. In 
the Cloud9 environment you were able to create following the Week 1 readings, make sure you've updated the 
compiler first, by typing this command in the terminal:
sudo yum install -y gcc72 gcc72-c++
With that finished, you'll be ready to load the
provided files for this project. In the Cloud9
interface, if you click File > Upload Local
Files, you will see a popup appear that accepts
uploads from your personal computer. You can use this to upload the image-transform-given-ffles.zip file to 
your Cloud9 workspace. After you do so, you'll see that the zip file appears in the environment file listing on the
left of the screen.
Page 1 / 11Next, you'll want to extract the contents of the zip file to a new directory. Your terminal on Cloud 9 already has 
some commands for this, zip and unzip. First, type ls in the terminal and make sure you see the zip file in the 
same directory. If not, then as described in the earlier readings, you should use the cd command to change 
directory until you see the file in the same directory. (The file listing tree on the left side of the screen should 
make it easier to find.)
Once in the same directory as the zip file, you can enter this command to extract the contents of the file:
unzip -o image-transform-given-files.zip -d image-transform
This will unzip the files into an "image-transform" subdirectory, but be careful, because this will overwrite files 
in that subdirectory if it already exists! After you extract the code and image files, you'll see that you can 
double-click to view them directly in the Cloud9 workspace.
Now as you explore the files, there are several you should take note of. We are inviting you to edit these files in 
particular for the sake of the assignment; they are the only ones we will collect: ImageTransform.h, 
ImageTransform.cpp, uiuc/HSLAPixel.h, and uiuc/HSLAPixel.cpp. However, you don't necessarily need to
make drastic edits to all of these files! We'll talk more about them below. You can also preview some unit tests 
used for grading, and take a look at the PNG library code.
Page 2 / 11Part 1: HSLAPixel
Understanding Color Spaces
In this course, we will not be working with the physical properties of color that you may be familiar with from 
other sources (the “RGB color space” for red-green-blue channels.) Instead, we will be using an alternative 
color space that represents colors by human perception of color. The HSL color space uses the Hue, Saturation, 
and Luminance of the color. From the Adobe Technical Guides page on “The HSB/HLS Color Model”, Adobe 
explores these terms:
Hue
Hue (denoted as h) defines the color itself, for
example, red in distinction to blue or yellow. The
values for the hue axis run from 0–360° beginning
and ending with red and running through green,
blue and all intermediary colors like greenish-blue,
orange, purple, etc.
There are two main hues that we'll use later in this
assignment:
• "Illini Orange" has a hue of 11.
• "Illini Blue" has a hue of 216.
Saturation
Saturation (denoted as s) indicates the degree to which the hue differs from a neutral gray. The values run from
0%, which is no color saturation, to 100%, which is the fullest saturation of a given hue at a given percentage of
illumination.
Luminance
Luminance (denoted as l) indicates the level of illumination. The values run as percentages; 0% appears black 
(no light) while 100% is full illumination, which washes out the color (it appears white).
Page 3 / 11HSL Color Space
The full HSL color space is a three-dimensional space, but it is not a cube (nor exactly cylindrical). The area 
truncates towards the two ends of the luminance axis and is widest in the middle range. The ellipsoid reveals 
several properties of the HSL color space:
• At l=0 or l=1 (the top and bottom points of the ellipsoid), the 3D space is a single point (the color black 
and the color white). Hue and saturation values don’t change the color.
• At s=0 (the vertical core of the ellipsoid), the 3D space is a line (the grayscale colors, defined only by 
the luminance). The values of the hue do not change the color.
• At s=1 (the outer shell of the ellipsoid), colors are vivid and dramatic!
Part 1 Programming Objectives
You need to create a class called HSLAPixel within the uiuc namespace in the file uiuc/HSLAPixel.h. Each 
pixel should contain four public member variables:
• h, storing the hue of the pixel in degrees between 0 and 360 using a double
• s, storing the saturation of the pixel as a decimal value between 0.0 and 1.0 using a double
• l, storing the luminance of the pixel as a decimal value between 0.0 and 1.0 using a double
• a, storing the alpha channel (blending opacity) as a decimal value between 0.0 and 1.0 using a double
Page 4 / 11That's it! Once you have this simple class, you are ready to compile and test Part 1 of this assignment.
Compiling Your Code
To compile the code, you must use the terminal to enter the same directory where the Makefile is stored; it's in 
the top directory next to main.cpp. As explained in the readings, use cd to change to the appropriate directory, 
use ls to view the file list in that directory, and then type make to automatically start the compilation. If you 
need to clear out the files you've previously built, type make clean. If you encounter any warnings or errors 
during compilation, study the messages in the terminal carefully to figure out what might be wrong with your 
code.
The primary compilation sequence, once successful for all parts of this MP, will build an executable file simply 
called ImageTransform in the top directory. You'll be able to run it by typing ./ImageTransform in that 
directory to launch a sequence of image processing operations. However, first you will also want to compile 
the test suite and make sure you are doing Parts 1 and 2 correctly with unit tests. To compile the tests, type 
make test in the top directory. If successful, this will generate an executable called test, which you can run 
by typing ./test in the same directory. We use the widely-used C++ testing framework Catch. You are always 
encouraged to write additional test cases; the executable Catch generates will run all of your tests and show you 
a report.
Working on your code is an iterative process. After doing Part 1, you will only be passing 4 of the tests. You 
should continue on to Part 2 to pass the rests of the tests. However, if any of the tests fail, you can always find 
out more by reading the message and peeking at the test source code files in the tests directory. The unit tests 
will usually point out a contradiction they have found by running your code: the test asserted that a certain 
result should have taken place, but the program did something else instead. Here is what you'll see when you've 
only finished Part 1:
For example, this part of the unit test report is saying that the value it had expected (0.7, on the left of the 
equality) is not the same as the value it found with your program (0.5, on the right of the equality). The values 
should be equal (==), but they're not yet. But, there's no need to get too worried about unit tests for features you 
haven't gotten around to implementing yet. That's why the ideal unit test ensures that the smallest possible 
component is working correctly, in isolation; then, your large-scale engineering problem breaks down into a 
series of many tiny steps.
Page 5 / 11By time you've finished the next part of the assignment, you should be able to pass all of the tests, resulting in a 
clean report like this one.
Part 2: Using uiuc::PNG
Now that we have an HSLAPixel, it's time to manipulate some images! First, let's understand the PNG class that
is provided for us! Note that PNG stands for "portable network graphics." It's a useful image file format for 
storing images without degradation (called losssless compression). A photograph saved as PNG will have a 
much larger filesize than a JPEG, but it will also be sharper and the colors won't bleed together as happens with 
JPEG compression. Apart from photographs, though, PNG offers relatively small filesizes for simple graphics 
with few colors, making it a popular choice for small details in a website user interface, for example.
Inside of your uiuc directory, you may have noticed PNG.h and PNG.cpp. We have provided an already 
complete PNG class that saves and loads PNG files and exposes a simple API for you to modify PNG files. (An 
API, or application programming interface, just means the documented, surface-level part of the code that you 
work with as someone who is making use of the library. You do not need to fully understand how the PNG class
works underneath in order to use it. But, it's good for you to practice surveying library code, seeing how it is 
organized, and taking note of its intended usage.)
In C++, the scope resolution operator, ::, denotes the fully-qualified name of a function or variable that is a 
member of a class (or namespace). So, you will see things like class name::member name in writing and in 
code, in some contexts. Note how this is different from the member selection operator, ., which appears in 
contexts like class instance.member name. This is because :: shows a relationship to an entire class or to a 
namespace, whereas the . operator shows a relationship to a single instance of an object.
Note that some of the class members utilize pass-by-reference as shown by the & operator; this is fully explained
in Week 3. It means that a direct reference to the memory is being passed, which uses the same concept of 
indirection that pointers offer, but with a simple syntax—you just use the variable as you would normally, not 
by dereferencing a memory address explicitly with the * operator as pointers do, and yet you are still able to 
implicitly manipulate the data located at the original memory location. This convenience feature was one of the 
benefits of C++ over the older C language.
Page 6 / 11For loading and saving PNG files:
• bool PNG::readFromFile(const std::string & fileName) loads an image based on the provided 
file name, a text string. The return value shows success or failure. The meaning & is discussed in Week 3 
in the lecture about variable storage; it means a direct reference to the memory is being passed, similar 
to a pointer.
• bool PNG::writeToFile(const std::string & fileName) writes the current image to the provided
file name (overwriting existing files).
For retrieving pixel and image information:
• unsigned int PNG::width() const returns the width of the image.
• unsigned int PNG::height() const returns the height of the image.
• HSLAPixel & getPixel(unsigned int x, unsigned int y) returns a direct reference to a pixel at 
the specified location.
Other methods:
• Methods for creating empty PNGs, resizing an image, etc. You can view uiuc/PNG.h and 
uiuc/PNG.cpp for complete details.
Sample Usage of PNG
Suppose we want to transform an image to grayscale. Earlier you learned that a pixel with a saturation set to 0%
will be a gray pixel. For example, here’s this transformation applied to the Alma Mater. The image on the left is 
the original, and the one on the right has been desaturated:
The source code that used the PNG class to create this grayscale transformation above is as follows (which is 
also provided to you in ImageTransform.cpp):
 Page 7 / 11/**
 * Returns an image that has been transformed to grayscale.
 * The saturation of every pixel is set to 0, removing any color.
 * @return The grayscale image.
 */
PNG grayscale(PNG image) {
 /// This function is already written for you so you can see how to
 /// interact with our PNG class.
 for (unsigned x = 0; x < image.width(); x++) {
 for (unsigned y = 0; y < image.height(); y++) {
 HSLAPixel & pixel = image.getPixel(x, y);
 // `pixel` is a reference to the memory stored inside of the PNG `image`,
 // which means you're changing the image directly. No need to `set`
 // the pixel since you're directly changing the memory of the image.
 pixel.s = 0;
 }
 }
 return image;
}
Here the pixel itself is passed by reference, although for simplicity, the image manipulation functions 
themselves in ImageTransform.cpp simply pass the images by value, which means they pass an entire new 
copy of the image each time. In the future, in practice, you'll find that it's more efficient to indirectly refer to 
large memory objects using pointers and references instead of making extra copies just to pass between 
functions. Many scripting languages today use reference semantics for almost everything by default, but C++ 
gives you more control to choose when memory is copied or when it is altered in-place.
Part 2 Programming Objectives
For the rest of the assignment, you should finish implementing the functions in ImageTransform.cpp: 
illinify, spotlight, and watermark. You'll find that the grayscale function discussed above has already been
completed for you. There are some comments on the function bodies with notes about their implementation. 
You may want to make use of some basic mathematical functions that are available because of the 
#include <cmath> in ImageTransform.h, but that's not required.
As you know, all C++ programs begin their execution with the main function, which is usually defined in 
main.cpp. You can find that a main function has been provided for you that:
• Loads in the image alma.png
• Calls each image modification function
• Saves the modified images named as out-modification.png, where modification shows the function 
being tested (e.g. out-grayscale.png)
Descriptions and examples of the three remaining functions are given below:
Page 8 / 11Function #1: illinify
To illinify an image is to transform the hue of every pixel to Illini Orange (11) or Illini Blue (216). The hue of 
every pixel should be set to one or the other of these two hue values, based on whether the pixel's original hue 
value is closer to Illini Orange or Illini Blue. Remember, hue values are arranged in a logical circle! If you keep 
increasing the hue value, for example, what should eventually happen?
Function #2: spotlight
To spotlight an image is to create a spotlight pattern centered at a given point (centerX, centerY).
A spotlight adjusts the luminance of a pixel based on the distance between the the pixel and the designated 
center by decreasing the luminance by 0.5% per 1 pixel unit of Euclidean distance, up to an 80% decrease in 
luminance at most.
For example, a pixel 3 pixels above and 4 pixels to the right of the center is a total of sqrt(3*3 + 4*4) 
= sqrt(25) = 5 pixels away and its luminance is decreased by 2.5% (0.975 its original value). At a distance 
over 160 pixels away, the luminance will always be decreased by 80% (0.2x its original value).
Page 9 / 11Function #3: watermark
To watermark an image is to lighten a region
of it based on the contents of another image
that acts as a stencil.
You should not assume anything about the
size of the images. However, you need only
consider the range of pixel coordinates that
exist in both images; for simplicity, assume
that the images are positioned with their
upper-left corners overlapping at the same
coordinates.
For every pixel that exists within the bounds
of both base image and stencil, the luminance of the base image should be increased by +0.2 (absolute, but not 
to exceed 1.0) if and only if the luminance of the stencil at the same pixel position is at maximum (1.0).
Submitting Your Work
As described previously, you should extensively check that your code compiles in your own IDE before you 
prepare to submit it. Be sure to do make and run ./ImageTransform to see that your images turn out as 
expected, and also do make test followed by ./test to check that you aren't forgetting anything.
When you're ready to hand in your work, you should use cd to navigate to the directory where your main.cpp 
and Makefile are, and then run make zip to generate a submission file automatically, called 
Page 10 / 11ImageTransform_submission.zip. It will contain
only the four code files being collected for grading.
You can find the generated file in the file browser in
the left pane. If you right-click on it, you'll see a
Download option; save the zip file to your own
computer. Now, if you go to the Week 4
programming assignment item on Coursera, you
will be able to submit this zip file for autograding.
The autograding procedure may take some minutes
to show a result, but this time it should reflect what
you expected based on your unit testing. In some
projects there may be additional hidden edge cases
tested in the final grading.
Please also note: If you see a link on the Week 4
assignment submission page mentioning
"upgrading" your assignment to a new version, be
sure to click it, so that Coursera will update the
assignment page you've already signed into to connect to the newest version of the autograder.
If you have any questions, be sure to ask on the discussion forums!
Page 11 / 11
請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp





 

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:代寫 MATH1041&#160;Statistics&#160;for&#160;Life
  • 下一篇:菲律賓補辦旅行證多久能拿到(補辦的流程)
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運營技巧,多多開團(tuán)助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團(tuán)助手
    CAE有限元仿真分析團(tuán)隊,2026仿真代做咨詢服務(wù)平臺
    CAE有限元仿真分析團(tuán)隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗證碼 寵物飼養(yǎng) 十大衛(wèi)浴品牌排行 suno 豆包網(wǎng)頁版入口 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    欧美日韩天天操| 免费国产成人av| 色婷婷av一区二区三区久久| 国产青春久久久国产毛片| 免费看污久久久| 免费国产一区| youjizz.com亚洲| 97免费视频在线播放| 久久亚洲高清| 久久精品99无色码中文字幕| 国产精品久久久久久中文字| 久久97久久97精品免视看 | 91免费国产网站| 91精品在线播放| 国产成人91久久精品| zzijzzij亚洲日本成熟少妇| 国产成人精品无码播放| 麻豆乱码国产一区二区三区 | av色综合网| 国产成人综合av| 久久精品视频播放| 蜜月aⅴ免费一区二区三区| 亚洲色欲综合一区二区三区| 日韩免费在线视频| 国产中文字幕乱人伦在线观看| 成人免费91在线看| 久久久精品在线视频| 久久久久久亚洲精品不卡4k岛国| 日韩一区二区三区国产| 国产精品国产三级国产专播精品人 | 蜜臀久久99精品久久久酒店新书| 国产亚洲精品久久久久久久| 超碰网在线观看| 久久久久久这里只有精品| 国产精品久久久对白| 亚洲一区二区免费| 欧美在线中文字幕| 高清在线观看免费| 三级精品视频久久久久| 在线一区日本视频| 青青草国产精品| 成人精品小视频| 精品国产欧美成人夜夜嗨| 一区二区三区观看| 欧美日韩一区在线播放| 777久久精品一区二区三区无码| 国产精品免费一区二区三区四区| 亚洲影院在线看| 蜜桃传媒一区二区| 久久久噜噜噜久久| 亚洲综合欧美日韩| 国内精品在线一区| 久久人人爽人人爽人人av| 国产精品免费看久久久无码 | 国产欧美在线播放| 久久久久久久亚洲精品| 欧美精品激情在线观看| 欧洲精品一区二区三区久久| 97久久精品人人澡人人爽缅北| 国产精品久久久久久久小唯西川 | 欧美激情国产精品日韩| 91精品国产91久久久久久不卡| 国产精品三级美女白浆呻吟| 亚洲乱码国产一区三区| 国产一区亚洲二区三区| 日韩在线中文视频| 午夜美女久久久久爽久久| 国产亚洲情侣一区二区无| 精品激情国产视频| 品久久久久久久久久96高清| 久久男人的天堂| 亚洲bt天天射| 91精品国产综合久久久久久久久| 欧美激情久久久久久| 蜜桃传媒视频麻豆第一区免费观看| 日韩中文字幕国产精品| 日本一区二区三区免费看| 9a蜜桃久久久久久免费| 欧美另类99xxxxx| 黄色一级片av| 国产精品高潮视频| 激情深爱综合网| 国产精品爽黄69| 欧美一区深夜视频| 日韩视频在线观看免费| 欧美深夜福利视频| 久久精品国产亚洲精品| 欧美精品久久久久久久自慰| 久久久精品日本| 欧美精品自拍视频| 久久视频在线看| 免费在线观看日韩视频| 国产精品久久久久久久久免费| 欧美在线影院在线视频| 久久精品99久久香蕉国产色戒| 欧美自拍大量在线观看| 国产精品日韩一区二区| 国产专区一区二区三区| 九九精品在线观看| 国产精品一区二区久久久| 亚洲综合小说区| 国产chinese精品一区二区| 欧洲午夜精品久久久| 久久精品国产欧美激情| 男人舔女人下面高潮视频| 国产精品精品一区二区三区午夜版| 国产综合色一区二区三区| 久久久久国产精品免费网站| 国产伦精品一区| 亚洲精品国产系列| 久久av一区二区三区亚洲| 欧美国产视频在线观看| 九九热这里只有精品6| 91久久精品国产91久久| 青青久久av北条麻妃黑人| 国产精品成人在线| 97精品国产91久久久久久| 日本欧美一级片| 国产精品久久久久久久久久东京 | 久久久人成影片一区二区三区 | 国精产品99永久一区一区| 亚洲一区二区在线观| 久久国产精品免费观看| 欧美日韩一道本| 最新av网址在线观看| 久久精品人人做人人爽电影| 精品一区二区三区无码视频| 婷婷亚洲婷婷综合色香五月| 久久精品亚洲一区| 97国产suv精品一区二区62| 欧美中日韩免费视频| 伊人久久青草| 国产精品视频999| 久久久无码中文字幕久...| 蜜桃成人免费视频| 欧美一级片免费播放| 精品国产乱码久久久久久88av| 久久免费视频在线观看| 蜜桃av噜噜一区二区三| 日本不卡二区| 一区二区三区av| 国产精品日韩一区二区 | 国产精品av免费观看| 精品无人区一区二区三区| 日本精品一区二区三区在线播放视频| 久久香蕉国产线看观看网| 久久精品二区| 91九色精品视频| 国产精品直播网红| 蜜臀av性久久久久蜜臀av| 日韩伦理一区二区三区av在线| 一区二区三区视频| 国产精品精品视频| 国产成人免费91av在线| 国产极品精品在线观看| 国产欧美精品一区二区三区 | 亚洲在线免费看| 精品乱码一区二区三区| 久久精品国产96久久久香蕉| 久久久精品有限公司| 成人久久一区二区| 国产在线播放一区二区| 欧美深夜福利视频| 日本高清视频免费在线观看| 亚洲伊人久久大香线蕉av| 欧美成人精品影院| 国产精品成人久久电影| 久久精品国产免费观看| 国产成人一区二区三区| 91精品国产色综合久久不卡98| 国产伦精品一区二区三区四区免费| 蜜臀av.com| 精品一卡二卡三卡四卡日本乱码| 欧美日韩精品久久| 欧美在线视频a| 欧美在线精品免播放器视频| 日韩国产一区久久| 日本a级片电影一区二区| 亚洲精品免费网站| 亚洲乱码一区二区三区| 亚洲精品偷拍视频| 亚洲精品在线免费看| 亚洲欧洲一区二区| 亚洲成人网上| 亚洲精品高清国产一线久久| 亚洲成人一区二区三区| 午夜精品蜜臀一区二区三区免费| 亚洲国产精品一区在线观看不卡| 亚洲视频欧美在线| 熟妇人妻va精品中文字幕| 色香蕉在线观看| 日韩欧美一区二区在线观看| 日韩精品最新在线观看| 欧美日韩精品久久久免费观看| 女女同性女同一区二区三区91 | 国产精品免费视频一区二区| 国产精品久久久久久亚洲调教 | 欧美精品一区二区三区国产精品| 国产精品久久国产三级国电话系列| 国产精品视频精品视频|