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

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫159.102、代做C++程序設計

時間:2023-11-24  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



159.102 Instructions for Assignment 3
Assignment 3 starts in Week 9 and is due in Week 11 (26 October 2023).
NOTE: Assignment 3 counts 10% towards your final result.
It is a good idea to put your name and ID number in a comment at the top of your program.
You have been given a contract by a factory that produces buttons. It is important that the factory
identifies damaged buttons so that they are not supplied to the stores. The factory has a camera that takes
a photo of buttons. The camera works only in black and white (no colour) and the resolution is not very
good, but that is not a problem.
Your job is to write a C++ program that identifies any damaged buttons in the photo. You need to
produce an image that displays a box around each button. If the button is damaged you must display a
red box and if the button is not damaged you must display a green box. Make sure you read carefully
through all the sections below.
Section A - input
The input to your program is the photo taken by the camera in the factory. This is available in a .ppm file
called Buttons.ppm. This file is available under Assessments on Stream. Do not edit this file in any way.
If you accidently modify the file then download a fresh copy of the file from Stream.
Your program must be able to work with any such photo. Do not assume a specific number of buttons.
Do not assume that buttons will always be in the same place in the photo. You can assume that buttons
are always the same basic size and that buttons will not be touching each other.
(Hint: Before starting on your program, check that the .ppm file has no errors. Download Buttons.ppm
from Stream and convert it to .bmp (or other format) and look at it. The display should look like this:
Just for interest – you can tell that the resolution of the camera is low because of the “stepped” edges to
the buttons in the image. Actually, for many problems of this type (i.e. identifying defects in products) it
is often better to use a black-and-white photo because the defects stand out more clearly.
2
Section B – understanding the problem
Like many “real-life” systems, this type of project can never be perfect (which is what makes real-life
projects interesting). We do the best we can by noting the following:
Notes about the problem:
1. Buttons appear as white (or light grey) objects on a dark background. This is a black-and-white
photo which means every pixel is a shade of grey (i.e. the R, G and B values are the same for each
pixel). We define a pixel to be part of a button if its R (or G or B) value is greater than 128.
2. There will always be a few pixels around the edge of a button (depending on the shadows) that are
darker than this and will thus not count as part of the button. This does not matter.
3. We need to know how to “identify” a button. Basically we look for pixels where the R value is
greater than 128. But we need more than this – see next section below.
4. To draw a box around a button you need to know the minimum and maximum x-value of all
pixels in the button and also the minimum and maximum y-value of all pixels. The box then has a
top left corner of (xmin, ymin) and a bottom right corner of (xmax, ymax) and so on.
5. Some thought needs to be given to how we define a “damaged” button. This is entirely up to you.
Hint: a damaged button will have less total pixels than an undamaged button.
Section C – the algorithm to identify a button in the image
A button consists of pixels with R value greater than 128 AND the pixels must touch each other. If we
work through every pixel, we can identify a button by:
a) finding a pixel with R value greater than 128
b) finding all other pixels that connect to that pixel (and have R value greater than 128)
c) go back to where we were in (a) and continue
The image below is trying to show this. Step (a) is shown in yellow. We start at the top left and work
steadily across and down the image until we find a suitable pixel. Step (b) is shown in red – we find all
pixels connected to the first one. Step (c) is shown in green – we go back to where we were at step (a)
and continue looking for pixels with R value greater than 128. Note that this diagram is to get the idea –
the drawing is not perfect.
Now let us look at step (b) in more detail – if we have one pixel in the button, how do we find the others?
3
Assume that we have found pixel A at location (x, y) with an R value of greater than 128. Thus we know
that pixel A is inside a button. We can then work through the pixels that touch pixel A (they are pixels B,
C, D and E). Note the locations of these pixels. Pixel B is in the same row of the image as pixel A so has
the same y value. But pixel B is one place to the left so it has a x value of x – 1. Pixel E is in the same
vertical column of the image as pixel A so has the same x value. But pixel E is one place further down
the screen so it has a y value of y + 1. Similarly for the other pixels.
Now that we know how to identify the “next door” pixels of pixel A, we have an algorithm as follows:
Find pixel A at location (x, y) and look for all connected pixels by:
Find pixel B at location (x – 1, y) and look for all connected pixels;
Find pixel C at location (x + 1, y) and look for all connected pixels;
Find pixel D at location (x, y – 1) and look for all connected pixels;
Find pixel E at location (x, y + 1) and look for all connected pixels;
This is a recursive algorithm – find the pixels connected to A by finding the pixels connected to B, etc.
While this may not look like the famous “caves” program, it is essentially the same situation. And we
have the same problem. We could develop an infinite loop where pixel A checks pixel B which checks
pixel A which checks pixel B, etc. And we solve the problem in the same way, i.e. we put a boolean into
each pixel and as soon as we have checked a pixel we exclude it from the search. Do not check that pixel
again.
Every recursive function needs a base case. In this case there are two which are:
- return if the pixel you are checking has an R values of 128 or less
- return if this pixel is excluded from the search (i.e. if this pixel has been checked before)
Some astute readers may have noticed that we are going on as if they are FOUR pixels next door to pixel
A when in fact there are EIGHT next door pixels. We left out the diagonal pixels. The reason for this is
that the recursion eventually works its way through all adjacent pixels. E.g. the pixel that is up and to the
left of A is also above B so will be checked when B is checked.
4
Section D – program design
There was another programmer who used to work at the factory. Unfortunately, that programmer did not
study 159.102 at Massey and was therefore unable to complete the project. You may find some
interesting ideas in the partially completed program which is called Ass3-start.cpp and is available under
Assessments on Stream.
Download the program called Ass3-start.cpp and study it.
You MUST use the class called pixel_class. Note that two of the methods are at the end of the program.
This class is as discussed in the notes but has an extra boolean variable called exclude to assist with the
recursive function. This exclude variable is set to false at the start of the program and is set to true if this
particular pixel has been checked.
You MUST use the following global variables:
int screenx, screeny, maxcolours;
pixel_class picture[600][600];
It is highly recommended that you also use the global variables:
int total, xmin, xmax, ymin, ymax; // these MUST be global
However, if you make the program work without these variables then you do not need to use them.
You MUST use the function called loadButtons exactly as it is in the program.
The rest is up to you. You can keep everything currently in the program or replace some of it as long as
you use the compulsory sections of code listed above.
The basic outline of the main program is as follows:
• load the photo data into the picture using the function loadButtons
• work through all pixels identifying buttons and placing boxes into the picture
• write the picture data to a new .ppm file
• (outside your program) convert your new .ppm file to .bmp and view it
Extra notes on drawing a box:
You draw a box (or in fact anything) by placing pixels of a particular colour into the picture.
A box needs four values called xmin, xmax, ymin, ymax.
The top left corner of the box is (xmin, ymin) and the top right corner of the box is (xmax, ymin).
The bottom left corner of the box is (xmin, ymax) and the bottom right corner of the box is (xmax, ymax).
To draw the top line of the box, use the following loop (or similar):
for (x = xmin; x <= xmax; x++) {
 picture[x][ymin].loaddata(R, G, B);
 picture[x][ymin].setexclude(true);
}
It is very important to set the exclude variable in each pixel to true. These pixels are now part of a box
and no longer part of the buttons image. They must be excluded from any future searches for buttons.
5
Section E – output
The output from your program is an image stored in a .ppm file. In order to view the image you will
probably need to convert it to a different format, e.g. a .bmp file.
The output image must show the buttons with boxes displayed around each button. The box must be red
if the button is damaged and green if the button is acceptable. It should look like this:
Oh dear, this image shows only green boxes. This is not the correct result.
Note 1: if you look very closely, you may see that some boxes do not perfectly sit around the button.
There may be one or two pixels on the “wrong side” of the green line. Do not worry about this. Do not
waste hours of time trying to get your boxes better than what is shown above. These boxes are perfectly
adequate to show which button is being referred to.
Note 2: you need to decide what defines a “damaged” button. Some buttons are obviously damaged,
others may be ok, not quite sure about that. Welcome to programming in the real world! As long as the
obviously damaged buttons are classified as damaged, that is ok. There may be one or two buttons that
some people may regard as damaged and other people may not. In the real factory, the “damaged”
buttons are checked by human experts before being discarded.
Some general notes about the assignments in 159.102
• You can find the assignment instructions in a file under Assessments and also the start week.
• You submit your assignments via Stream (under Assessments) before the due date and time
• The due date and time appear on the Assignment under Assessments (where you submit)
• Submit only your .cpp file
• Do not submit the .exe file or any data files or screen shots of the program running
6
• Staff are not available to check your assignment before you submit it.
• Do not rush into submitting an assignment. You may find useful information in the notes during
the week after the assignment starts.
• Assignments may use C++ knowledge from 159.101, 159.102 and elsewhere. However, if you
use knowledge from elsewhere, make sure you use it correctly.
IMPORTANT rules for assignments in 159.102
• You may get assistance when writing an assignment. Assistance includes asking questions and
getting ideas from teaching staff and other students. Assistance also includes asking for help
when your program is not working correctly and you cannot find the error.
• You may NOT get someone else to write your assignment for you. If you submit a program
written by someone else, you will lose a significant amount of the marks for the assignment.
• You may NOT copy a program from the internet. If you submit a program copied from the
internet you will receive ZERO marks for the assignment. It is very easy for markers to find the
same program on the internet.
• The important thing is that you must show that you understand what is happening in the program
you submit. Teaching staff will sometimes arrange zoom sessions with students to check that they
understand their submission. If this happens to you, please do not be offended – it is something
we have to do as part of the quality assurance for the course.
Working on your assignments in 159.102
• You need an editor/compiler to create and run your program. Atom is provided (see notes to
install Atom under Week 1) but you can use any other IDE that supports C++
• Build up your program, for example: start by only converting decimal to binary. When this is
working include binary to decimal. Then build in the error checking.
• Give yourself plenty of time. Do not start 6 hours before the deadline!
• Do not give up just because the deadline arrives. You will still get some marks for a partial
solution. In a difficult situation, you can apply for an extension.
Marking criteria for assignments in 159.102
Assignments are marked out of 10 and marks can be lost for:
• programs not compiling or running
• errors in code
• programs that have not been tested for a variety of situations
• programs that do not follow the instructions that are provided
• programs that appear to be written by someone else
• programs that are copied from the internet

請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機打開當前頁
  • 上一篇:代寫COMP1711、c++編程語言代做
  • 下一篇:4CCS1CS1代做、代寫c/c++,Python程序
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真技術服務
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲勞振動
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲
    流體cfd仿真分析服務 7類仿真分析代做服務40個行業
    流體cfd仿真分析服務 7類仿真分析代做服務4
    超全面的拼多多電商運營技巧,多多開團助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團助手
    CAE有限元仿真分析團隊,2026仿真代做咨詢服務平臺
    CAE有限元仿真分析團隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內
    釘釘簽到打卡位置修改神器,2026怎么修改定
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
  • 短信驗證碼 寵物飼養 十大衛浴品牌排行 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    国产精品视频在线观看| 国产精品亚洲综合天堂夜夜| 久久精品国产免费观看| 深夜福利国产精品| 色婷婷综合久久久久中文字幕1| 国产二级片在线观看| 777精品视频| 国产精品∨欧美精品v日韩精品| 91精品国产九九九久久久亚洲 | 欧美日韩国产免费一区二区三区| 日本精品久久久久久久久久| 日本10禁啪啪无遮挡免费一区二区| 日本在线观看一区二区| 日本一本草久p| 日韩女优在线播放| 欧美日韩无遮挡| 国产在线拍偷自揄拍精品| 国产欧美亚洲精品| 国产精品av免费在线观看| 久久99欧美| 国产精品日韩一区二区免费视频 | 少妇高潮流白浆| 成人免费无码av| 超碰97人人人人人蜜桃| 91麻豆精品秘密入口| 国产成人+综合亚洲+天堂| 久久久久久久久久久99| 国产精品爽爽ⅴa在线观看| 欧美日韩成人免费| 日韩精品一区在线视频| 不卡av日日日| 午夜在线视频免费观看| 欧美中文字幕视频| 国产一区免费观看| 久久久免费观看| 国产精品美女久久| 大j8黑人w巨大888a片| 欧美在线激情网| 成人黄色av网站| 久久九九国产精品怡红院| 亚洲综合日韩在线| 欧美 日韩 国产精品| 国产欧美日韩一区二区三区| 久久乐国产精品| 欧美精品久久久久久久久久久| 久久无码高潮喷水| 国产精品偷伦视频免费观看国产| 在线观看欧美亚洲| 热re99久久精品国产99热| 国产日韩一区在线| 色久欧美在线视频观看| 亚洲熟女乱色一区二区三区| 欧美中文字幕视频在线观看| 91麻豆蜜桃| 精品九九九九| 欧美伊久线香蕉线新在线| www.av毛片| 久久精品人人做人人爽| 亚洲自拍欧美另类| 精品嫩模一区二区三区| 97精品国产97久久久久久粉红 | 欧美日韩一区二区三区免费| 国产精品10p综合二区| 欧美精品免费在线| 欧美在线视频一二三| 国产精品av在线播放 | 久久99青青精品免费观看| 日本一区二区三区视频在线播放 | 一区二区高清视频| 蜜桃精品久久久久久久免费影院| 国产不卡精品视男人的天堂| 亚洲综合自拍一区| 欧美 日韩 国产一区| 久久露脸国产精品| 一本久道中文无码字幕av| 黄色91av| 国产精品入口免费| 男女超爽视频免费播放| 久久av一区二区三区漫画| 亚洲色图自拍| 国产免费久久av| 久久综合电影一区| 每日在线更新av| 国产精品美女久久| 黄频视频在线观看| 国产精品日韩高清| 欧美在线日韩在线| 久久精彩免费视频| 日本一区二区三区四区视频 | 色999五月色| 成人黄色一区二区| 欧美激情一二三| 成人黄动漫网站免费| 中文网丁香综合网| 成人精品一区二区三区电影黑人| 国产99久久精品一区二区 | 国产一区自拍视频| 国产精品久久精品视| 欧美一级视频在线观看| www.av中文字幕| 欧美激情一二区| 国产欧美精品久久久| 色综合天天狠天天透天天伊人| 国产午夜伦鲁鲁| 中文视频一区视频二区视频三区| 国产伦精品一区二区三区免| 久久国产精品影片| 粉嫩av一区二区三区天美传媒| 国产精品久久久久久搜索| 黄色免费高清视频| 久久成年人免费电影| 高清一区二区三区四区五区| 亚洲一区二区精品在线观看| 久久久成人精品一区二区三区| 日韩av在线综合| 久久人人爽人人爽人人片亚洲| 国产一级不卡毛片| 亚洲一区二区三区精品视频| 久久精品ww人人做人人爽| 激情小说网站亚洲综合网| 欧美激情久久久久久| 久久伊人一区二区| 欧美成人一区二区在线观看| 国产精品高潮呻吟久久av黑人| 国产麻豆一区二区三区在线观看| 性日韩欧美在线视频| 久久99精品久久久久久三级 | 国产综合中文字幕| 亚洲一区二区三区精品视频 | 中文精品一区二区三区| 国产v综合v亚洲欧美久久| 奇米精品一区二区三区| 欧美精品日韩www.p站| 97久久久久久| 欧美日韩一区二区三区在线视频| 欧美精品成人在线| 国产对白在线播放| 国产综合av在线| 色女人综合av| 精品国产乱码久久久久久108| 久久久女女女女999久久 | 国产精品久久久久久久久男| 成人h视频在线观看| 热久久精品国产| 中文字幕一区二区三区四区五区六区| 久久久久久99| 国产欧美在线视频| 日韩免费高清在线| 中文字幕黄色大片| 国产精品入口免费视频一| 国产福利久久精品| 国产精品亚洲精品| 麻豆一区二区三区在线观看| 日韩欧美在线一区二区| 亚洲一区在线免费| 九九热r在线视频精品| 国产成人精品一区二区在线| 91精品91久久久中77777老牛| 黄色片一级视频| 亚洲高清在线观看一区| 精品国产一区二区三区日日嗨 | 国产精品欧美风情| 欧美深夜福利视频| 日本精品福利视频| 日韩av电影在线网| 亚洲日本欧美在线| 美女国内精品自产拍在线播放| 久久精品最新地址| 久久久久久久国产精品视频| 粉嫩av免费一区二区三区| 韩国视频理论视频久久| 日本一本中文字幕| 亚洲精品国产精品国自产| 这里只有精品66| 久久99精品久久久久久青青91| 国产精品男人的天堂| 久久精品成人一区二区三区| 久久riav| 久久久伊人欧美| 高清国语自产拍免费一区二区三区| 国产综合 伊人色| 激情五月综合色婷婷一区二区| 欧美最猛性xxxx| 欧美午夜视频在线| 日韩视频一二三| 日韩精品一区二区三区不卡| 日本欧美一级片| 日韩毛片在线免费看| 欧美午夜视频在线| 欧美不卡福利| 国模精品一区二区三区色天香| 欧美综合激情| 欧美精品免费观看二区| 蜜桃传媒视频第一区入口在线看| 含羞草久久爱69一区| 国产在线精品成人一区二区三区| 国产精品狼人色视频一区| 91精品啪aⅴ在线观看国产| 91av一区二区三区| 国产极品粉嫩福利姬萌白酱|