首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写CS373 COIN、代做Python设计程序
项目预算:
开发周期:
发布时间:
要求地区:
DETECTION
ASSIGNMENT
2024 Semester 1
1
Version 2.2Deadline: 3rd June 2024, 23:59pm
●In this assignment, you will write a Python code pipeline to automatically detect all the coins in the
given images. This is an individual assignment, so every student has to submit this assignment! This
assignment is worth 15 marks.
●We have provided you with 6 images for testing your pipeline (you can find the images in the
‘Images/easy’ folder).
○Your pipeline should be able to detect all the coins in the image labelled with easy-level. This will
reward you with up to 10 marks.
○For extension (up to 5 marks), try images labelled as hard-level images in the “Images/hard” folder.
○Write a short reflective report about your extension. (Using Latex/Word)
●To output the images shown on the slides for checking, you may use the following code:
fig, axs = pyplot.subplots(1, 1)
# replace image with your image that you want to output
axs.imshow(image, cmap='gray')
pyplot.axis('off')
pyplot.tight_layout()
pyplot.show()
2SUBMISSION
Please upload your submission as a zipped file of the assignment folder to the UoA
Assignment Dropbox by following this link:
https://canvas.auckland.ac.nz/courses/103807/assignments/383790
●Don’t put any virtual environment (venv) folders into this zip file, it just adds to the size, and we
will have our own testing environment.
●Your code for executing the main coin detection algorithm has to be located in the provided
“CS373_coin_detection.py” file!
●You can either put all of your code into that file, or use a modular structure with additional files
(that, of course, have to be submitted in the zip file). However, we will only execute the
“CS373_coin_detection.py” file to see if your code works for the main component!
●The main component of the assignment (“CS373_coin_detection.py”) must not use any non-built-in
Python packages (e.g., PIL, OpenCV, NumPy, etc.) except for Matplotlib. Ensure your IDE hasn’t
added any of these packages to your imports.
●For the extensions, please create a new Python source file called
‘CS373_coin_detection_extension.py’
; this will ensure your extension part doesn’t mix up with the
main component of the assignment. Remember, your algorithm has to pass the main component
first!
●Including a short PDF report about your extension.
●Important: Use a lab computer to test if your code works on Windows on a different machine
(There are over 300 students, we cannot debug code for you if it doesn’t work!)
3easy_case_1 final output
easy_case_2 final output
easy_case_4 final output easy_case_6 final outputASSIGNMENT STEPS
5
1. Convert to greyscale and normalize
I. Convert to grey scale image: read input image using the ‘readRGBImageToSeparatePixelArrays()’ helper
function. Convert the RGB image to greyscale (use RGB channel ratio 0.3 x red, 0.6 x green, 0.1 x blue),
and round the pixel values to the nearest integer value.
II. Contrast Stretching: stretch the values between 0 to 255 (using the 5-95 percentile strategy) as described
on lecture slides ImagesAndHistograms, p20-68). Do not round your 5% and 95% cumulative histogram
values. Your output for this step should be the same as the image shown on Fig. 2.
Hint 1: see lecture slides ImagesAndHistograms and Coderunner Programming quiz in Week 10.
Hint 2: for our example image (Fig. 1), the 5_percentile (f_min) = 86 and the 95_percentile (f_max) = 173.
Fig. 1: input Fig. 2: step 1 output
We will use this image
(‘easy_case_1’) as an
example on this slides2. Edge Detection
I. Apply a 3x3 Scharr filter in horizontal (x) and vertical (y) directions independently to get the edge maps (see
Fig. 3 and Fig. 4), you should store the computed value for each individual pixel as Python float.
II. Take the absolute value of the sum between horizontal (x) and vertical (y) direction edge maps (see Hint 4). You
do not need to round the numbers. The output for this step should be the same as the image shown on Fig. 5.
Hint 1: see lecture slides on edge detection and Coderunner Programming quiz in Week 11.
Hint 2: please use the 3x3 Scharr filter shown below for this assignment:
6
Hint 4: you should use the BorderIgnore option and set border
pixels to zero in output, as stated on the slide Filtering, p13.
Hint 5: for computing the edge strength, you may use the
following equation:
gm
(x, y) = |gx
(x, y)| + |gy
(x, y)|
Absolute grey level
gradient on the
horizontal direction
Absolute grey level
gradient on the vertical
direction
Edge map on
horizontal and
vertical
Fig. 5: Step 2
output (gm
)
Fig. 4: Edge map
(gy
) on vertical
direction
Fig. 3: Edge map
(gx
) on horizontal
direction7
3. Image Blurring
Apply 5x5 mean filter(s) to image. Your output for this step should be the same as the image shown on
Fig. 7.
Hint 1: do not round your output values.
Hint 2: after computing the mean filter for one 5x5 window, you should take the absolute value of your
result before moving to the next window.
Hint 3: you should use the BorderIgnore option and set border pixels to zero in output, as stated on the
slide Filtering, p13.
Hint 3: try applying the filter three times to the image sequentially.
Hint 4: see lecture slides on image filtering and Coderunner Programming quiz in Week 11.
Fig. 7: Step 3 output Fig. 6: Grayscale histogram for output from step 38
4. Threshold the Image
Perform a simple thresholding operation to segment the coin(s) from the black background. After
performing this step, you should have a binary image (see Fig. 10).
Hint 1: 22 would be a reasonable value for thresholding for our example image, set any pixel value
smaller than 22 to 0; this represents your background (region 1) in the image, and set any pixel value
bigger or equal to 22 to 255; which represents your foreground (region 2) – the coin.
Hint 2: see lecture slides on image segmentation (p7) and see Programming quiz on Coderunner on
Week 10.
Fig. 9: Step 3 output Fig. 10: Step 4 output Fig. 8: Grayscale histogram for output from step 39
5. Erosion and Dilation
Perform several dilation steps followed by several erosion steps. You may need to repeat the dilation
and erosion steps multiple times. Your output for this step should be the same as the image shown on Fig.
11.
Hint 1: use circular 5x5 kernel, see Fig. 12 for the kernel details.
Hint 2: the filtering process has to access pixels that are outside the input image. So, please use the
BoundaryZeroPadding option, see lecture slides Filtering, p13.
Hint 2: try to perform dilation 3-4 times first, and then erosion 3-4 times. You may need to try a couple
of times to get the desired output.
Hint 3: see lecture slides on image morphology and Coderunner Programming quiz in Week 12.
Fig. 11: Step 5 output
Fig. 12: Circular 5x5 kernel for
dilation and erosion10
6. Connected Component Analysis
Perform a connected component analysis to find all connected components. Your output for this
step should be the same as the image shown on Fig. 13.
After erosion and dilation, you may find there are still some holes in the binary image. That is
fine, as long as it is one connected component.
Hint 1: see lecture slides on Segmentation_II, p4-6, and Coderunner Programming quiz in Week
12.
Fig. 13: Step 6 outputWe will provide code for drawing the bounding box(es)
in the image, so please store all the bounding box
locations in a Python list called ‘bounding_box_list’, so
our program can loop through all the bounding boxes
and draw them on the output image.
Below is an example of the ‘bounding_box_list’ for our
example image on the right.
11
7. Draw Bounding Box
Extract the bounding box(es) around all regions that your pipeline has found by looping over
the image and looking for the minimum and maximum x and y coordinates of the pixels in the
previously determined connected components. Your output for this step should be the same as
the image shown on Fig. 14.
Make sure you record the bounding box locations for each of the connected components your
pipeline has found.
Bounding_box_list=[[74, 68, 312, 303]]
A list of list
Bounding_box_min_x
Bounding_box_min_y Bounding_box_max_x
Bounding_box_max_y
Fig. 14: Step 7 outputInput
Drawing
Bounding Box
Color to Gray Scale
and Normalize
Edge
Detection
Image
Blurring Thresholding
Dilation and
Erosion
Connected
Component Analysis
12
Coin Detection Full Pipelineeasy_case_1 final output easy_case_2 final output
easy_case_4 final output easy_case_6 final outputEXTENSION
For this extension (worth 5 marks), you are expected to alter some parts of the pipeline.
●Using Laplacian filter for image edge detection
○Please use the Laplacian filter kernel on the right (see Fig. 15).
○You may need to change subsequent steps as well, if you decide to
use Laplacian filter.
●Output number of coins your pipeline has detected.
●Testing your pipeline on the hard-level images we provided.
○For some hard-level images, you may need to look at the size of the connected components to decide which
component is the coin.
●Identify the type of coins (whether it is a 1-dollar coin, 50-cent coin, etc.).
○Since different type of coins have different sizes, you may want to compute the area of the bounding box in
the image to identify them.
●etc.
Submissions that make the most impressive contributions will get full marks. Please create a new
Python source file called ‘CS373_coin_detection_extension.py’ for your extension part, and include a
short PDF report about your extension. Try to be creative!
14
Fig. 15: Laplacian filter kernel
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做 program、代写 c++设计程...
2024-12-23
comp2012j 代写、代做 java 设...
2024-12-23
代做 data 编程、代写 python/...
2024-12-23
代做en.553.413-613 applied s...
2024-12-23
代做steady-state analvsis代做...
2024-12-23
代写photo essay of a deciduo...
2024-12-23
代写gpa analyzer调试c/c++语言
2024-12-23
代做comp 330 (fall 2024): as...
2024-12-23
代写pstat 160a fall 2024 - a...
2024-12-23
代做pstat 160a: stochastic p...
2024-12-23
代做7ssgn110 environmental d...
2024-12-23
代做compsci 4039 programming...
2024-12-23
代做lab exercise 8: dictiona...
2024-12-23
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!