狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线

CSI 2120代做、代寫Python/Java設計編程

時間:2024-04-12  來源:  作者: 我要糾錯



Faculty of Engineering
School of Electrical
Engineering
and Computer Science
CSI 2120
Programming Paradigms
Similarity image search
Comprehensive assignment
(24%)
Winter 2024
Project for a group of 2 students at most
Part 1 due February 16th before 23:59
Part 2 due March 8th before 23:59
Part 3 and 4 due le April 22nd before 23:59
Late assignment policy: minus 10% for each day late. For example : a project due Friday night but
handed out on the Monday morning: -30%
Problem description
Nowadays, images are created and accumulated at a frenetic pace. It has become essential to have powerful
computer tools capable of analyzing these images and facilitating the search, classification, and discovery
of images of interest. In this project, you are asked to program a simple method for searching similar
images. By similar images, we mean images that resemble each other in terms of the content they present
and their visual appearance, colors and textures (for example, images showing sunsets).
Your program will manipulate color digital images. Let's then explain how these images are structured. A
digital image is divided into a rectangular grid in which each element is a pixel ('picture element'). This
grid contains a certain number of columns and rows, defining the image's resolution (for example, your
phone can probably produce images with a resolution of 4032x3024 pixels). A pixel contains the color
information associated with the corresponding position in the image. If your image were in grayscale (a
'black and white' image), each pixel would have a value between 0 and 255 (this 8-bit representation is
the most common), with 0 being black, 255 being white and the other values representing different shades
of gray. In the case of a color image, each pixel contains three values (three channels), corresponding to
the three primary colors: red, green, blue (RGB). These three values represent the amount of red, green,
and blue required to produce the desired color. For example, the color 255: red, 255: green, 0: blue will
produce a light yellow, while the color 50: red, 0: green, 0: blue will result in a dark red. The values
associated with a pixel are usually represented by a vector [R, G, B] containing the values for these three
channels (e.g. [255, 255, 0] for light yellow). Since each color can take a value between 0 and 255, the
combination of the three channels produces 256 x 256 x 256 different colors (i.e. more than 16 million).
CSI 2120 page 2
_________________________________________________________________________________________________
We are looking for similar images. So, let’s assume that images with similar colors should have similar
content. This is a simplistic assumption that is not always true but generally yields acceptable albeit
imperfect results. This is what we will verify in this project. Therefore, it is necessary to calculate the
histogram of an image and compare these histograms.
The histogram is simply the count of the colors contained in an image. It involves counting how many
pixels have the color [0, 0, 0], how many have the color [0, 0, 1], and so on. However, this would mean
counting the pixels for all 16 million possible colors, which is expensive and not very precise. It is
therefore recommended to reduce the color space. This can be done by simply reducing the number of
possible values, for example, by going from 8-bit values to 3-bit values per channel, resulting in a color
space of only 8 x 8 x 8 = 512 possible colors. In this case, a simple bit right-shift by 8 – 3 = 5 positions
reduces the space. The histogram will then have only 512 entries, a bin for each of the possible colors. To
compare images with different resolutions (different numbers of pixels), it is necessary to normalize the
histogram, i.e., divide each entry by the total number of pixels (such that by summing all the values of the
histogram, we will obtain 1.0).
Histogram comparison
As explained, the images will be compared by comparing their histograms. This can be done using
histogram intersection which can be computed, for the histograms H1 and H2, as follows:
If the two histograms are identical, this sum will give a value equal to 1.0. Conversely, if the two images
have no colors in common, then their histogram intersection will be equal to 0.0. Consequently, the more
similar are two images, the closer to 1.0 will be their histogram intersection.
Searching similar images
You are asked to find the images that are similar to a query image using color histogram intersection. An
image dataset will be provided for the search. The algorithm that searches the K most similar images to a
query image I using a color space reduced to D bits is as follows:
1. Compute the reduced color histogram of I
a. Reduce the pixel values by applying (8-D) right bit shifts for each channel R, G, B.
i. R' = R >> (8-D)
ii. G' = G >> (8-D)
iii. B' = B >> (8-D)
b. The number of bins in the histogram H will be N=2D * 3
c. Count how many pixels of each color are contained in I to obtain histogram H. The
histogram H is an array of N elements.
CSI 2120 page 3
_________________________________________________________________________________________________
i. The index of the histogram bin corresponding to color [R',G',B'] can be computed
as (R' << (2 * D)) + (G' << D) + B)
d. Normalize H such that the values of all its bins sum to 1.0
2. Compare H with all pre-computed histograms in the image set.
a. This comparison is done using histogram intersection
b. Returns the K images with distances the closest to 1.0
Programming
You have to write programs under different paradigms that solve different versions of this problem. You
will receive specific instructions for each language.
Each program will be marked as follows:
Program produces the correct result [3 points]
Adherence to programming paradigm [2 points]
Quality of programming (structures, organisation, etc) [1 point]
All your files must include a header showing student IDs and names of the group members.
All files must be submitted in a zip file.
CSI 2120 page 4
_________________________________________________________________________________________________
Dataset
• You have access to a dataset of images. The images are provided in jpg format. The histogram of
each image in this dataset has been computed (3 bits per channel) and saved in a text file.
• We also give you 16 query images. You will have to find the 5 most similar images to each query
images. The query images are provided in jpg and ppm format, you can use one or the other.
CSI 2120 page 5
_________________________________________________________________________________________________
1. Object-oriented part (Java) [6% of your final mark]
Since this solution must follow the object-oriented paradigm, your program must be composed of a set of
classes. Specifically, it must include, among others, the classes listed below.
In addition to the source code of your solution, you must also submit a document that includes a UML
diagram of all your classes (showing attributes, associations and methods). Do not use static methods,
except for the main function. This document must also cite all references used to build your solution.
• The SimilaritySearch class
o that contains the main method
▪ you must specify the image filename, the image dataset directory
• java SimilaritySearch q01.jpg imageDataset2_15_20
▪ you can assume that the histograms of the image dataset have been pre-computed
▪ however, you must compute the histogram of the query image
▪ you can assume that the search is done on 3-bit color reduced images but make
your program as generic as possible (no hard-coding of the depth value except in
the main method).
▪ The program must print the name of the 5 most similar images to the query image
• The ColorImage class that includes
o A constructor that creates an image from a file
▪ public ColorImage(String filename)
▪ you can read the image from the jpg or the ppm format (just choose one format)
• you can use the JMF Java API to read jpg images
• the ppm format is just a text file with the RGB values listed
▪ the pixel values of the images are stored in an array representation of your choice
(to be described in the submitted document)
o The following image attributes (and the corresponding getter methods)
▪ int width
▪ int height
▪ int depth (the number of bit per pixel)
o A getPixel method that returns the 3-channel value of pixel at column i row j in the
form of a 3-element array
▪ public int[3] getPixel(int i, int j)
o A reduceColor method that reduces the color space to a d-bit representation
▪ public void reduceColor(int d)
CSI 2120 page 6
_________________________________________________________________________________________________
• The ColorHistogram class that includes
o A constructor that construct a ColorHistogram instance for a d-bit image
▪ public ColorHistogram (int d)
o A constructor that construct a ColorHistogram from a text file
▪ public ColorHistogram (String filename)
o A setImage method that associate an image with a histogram instance
▪ public void setImage(ColorImage image)
o A getHistogram method that returns the normalized histogram of the image
▪ public double[] getHistogram()
o A compare method that returns the intersection between two histograms
▪ public double compare(ColorHistogram hist)
o A save that saves the histogram into a text file
▪ public void ColorHistogram (String filename)
o plus any other classes, methods or attributes you judge necessary
CSI 2120 page 7
_________________________________________________________________________________________________
2. Functional programming part (Scheme) [6% of your final mark]
For this part of the comprehensive assignment, we ask you to implement the Image Similarity Search
algorithm following the functional paradigm. Refer to the general problem description section for the
algorithmic steps.
The requirements are the same as for the Object-oriented part, except that, this time, you do not have to
generate the histograms of the query images. You can use the histogram files that you have generated
using your Java program.
You must create the following function in order to start your program:
(similaritySearch queryHistogramFilename imageDatasetDirectory)
This function should return the name of the 5 most similar images to the query image. You will obviously
have to create other functions. Remember that under the functional paradigm, it is much better to create
several short functions than few long ones.
Submit your project in a zip file containing the scheme functions file and a document listing the functions
you have created, and the output obtained for each of the query image. This document must also cite all
references you may have used to build your solution.
All your Scheme functions must have a header describing what the function does, the input parameters
and the output.
You are not allowed to use functions terminating by ! (such as the set! function) and you must not use
iterative loops, use recursion instead.
CSI 2120 page 8
_________________________________________________________________________________________________
3. Concurrent programming part (Go) [6% of your final mark]
For the concurrent part of the comprehensive assignment, we ask you to program the image similarity
search algorithm using multiple threads. To make it more computationally expensive, your program will
have to compute all histograms (from the query and database images) each time you perform a query.
Your go program is executed with the following arguments:
> go run similaritySearch queryImageFilename imageDatasetDirectory
Note: os.Args provides access to the command line arguments.
Reading a jpeg image
Fortunately, if you look at the Go documentation about the image package, https://pkg.go.dev/image, you
will find an example showing how to compute the histogram of an image. This is not exactly what you
have to do but this is a great starting point. A slightly modified version of this example is provided; it has
the signature of the histogram Go function you will have to write.
type Histo struct {
 Name string
 H []int
}
func computeHistogram(imagePath string, depth int) (Histo, error)
This function computes the histogram of the specified jpeg image and reduces it to the number of bits
given by the depth parameter. The starting code is relatively easy to follow, one thing to notice is that the
pixel values of images in Go are store in uint32 and you must right-shift the bits of each channel by 8
positions to get the correct range (0 to 255). Check the provided code, it simply displays the RGB values
of an image.
You will also need a function that computes the histograms of a slice of image filenames.
func computeHistograms(imagePath []string, depth int,
 hChan chan<- Histo)
When a histogram is computed, it is sent to the given channel.
CSI 2120 page 9
_________________________________________________________________________________________________
The main function
Your main function must perform the following operations:
1. Create the channel of histograms;
2. Get the list of all image filename in the dataset directory;
3. Split this list into K slices and send each slice to the go function computeHistograms;
4. In a separate thread, open the query image and compute its histogram
5. Read the channel of histograms
a. When a histogram is received compare it to the query histogram
b. Based on the similarity results, maintain a list of the 5 most similar images
6. Once all images have been processed, print the list of the 5 most similar images.
7. Close all channels and make sure all threads are stopped before the program terminates.
Experiments
In order to determine the optimal configuration for your concurrent algorithm, we ask you to perform the
following experiments and report the execution time for each case:
• K=1
• K=2
• K=4
• K=16
• K=64
• K=256
• K=1048
Create a graph showing running time versus number of threads (use the average running time for all
queries). Do not forget to not print text to the console while you are estimating running time, this would
considerably slow down your program. Also specify the operating system and the specifications of your
processor (including the number of cores). You can also add your own experiences with other
configurations. Remember that your program must compute all histograms (from query and dataset
images), do not use the pre-computed histogram text files.
In addition to your source code, you must submit a document showing the results of your experiments.
CSI 2120 page 10
_________________________________________________________________________________________________
4. Logical programming part (Prolog) [6% of your final mark]
For this last part of the comprehensive assignment, you have to implement the Image Similarity Search
algorithm following the logic programming paradigm. Refer to the general problem description section
for the algorithmic steps.
The requirements are the same as for the other parts, except that, this time, you do not have to generate
the histograms of the images. You can use the histogram text files for both the query and dataset images
that are provided.
You must create the following predicate that solves this problem as follows:
?- similarity_search('q00.jpg.txt',S).
S = [('2144.jpg.txt', 0.8799533333333334), ('1998.jpg.txt',
0.86362), ('3538.jpg.txt', 0.79226), ('3920.jpg.txt', 0.77334),
('4923.jpg.txt', 0.76828)] .
(note that the solution shown is not correct, it is only provided to demonstrate the format of the solution).
We give you a starter project that includes most of the predicates required. In particular, the one that reads
a histogram file and returns a list will be very useful.
?- read_hist_file('q00.jpg.txt',H).
H = [2715, 22, 0, 0, 0, 0, 0, 0, 2|...] .
The one that generates the list of text files in a directory is also useful.
?- dataset(D),directory_textfiles(D,L).
D = 'C:\Users\Documents\imageDataset2_15_20\',
L = ['1000.jpg.txt', '1001.jpg.txt', '1003.jpg.txt', '1004.jpg.txt',
'1005.jpg.txt', '1006.jpg.txt', '1007.jpg.txt', '1008.jpg.txt',
'1009.jpg.txt'|...].
Note how the dataset directory path is provided through the predicate dataset/1.
CSI 2120 page 11
_________________________________________________________________________________________________
Finally, we also provide you with the predicate that performs the high-level algorithm.
similarity_search(QueryFile,DatasetDirectory, DatasetFiles,Best):-
 read_hist_file(QueryFile,QueryHisto),
%1.
 compare_histograms(QueryHisto, DatasetDirectory,
 DatasetFiles, Scores), %2.
 sort(2,@>,Scores,Sorted), %3.
 take(Sorted,5,Best). %4.
As you can see, this predicate first read the histogram file of the query image (read_hist_file/2). It then
compares this histogram with all the histograms in the list of histogram files (compare_histograms/4) by
producing a list of (HistogramFilename,Score) pairs. The next step sorts the obtained list (sort/4) from
which the first 5 pairs are extracted (take/3).
Read this Prolog file carefully and implement the missing predicates.
Submit your project in a zip file containing the well-commented Prolog predicates; all your Prolog
predicates must have a short header describing what the predicate does and its parameters. Also include a
document showing the output obtained for each of the query image.
CSI 2120 page 12
_________________________________________________________________________________________________
Rules
You can do this assignment in a group of two to learn team work. Make sure you collaborate both in
thinking and brainstorming about this problem and programming with your partner. Any similarity
between your programs to other groups is considered plagiarism. Yes, if you do not like team work, you
can do it alone. Do not use any code or program from the Internet because it is also considered plagiarism.
See the university policies for plagiarism in the following link.
https://www2.uottawa.ca/about-us/provost
Important Note: Using ChatGPT is strictly forbidden, if your TA sees that your code comes from
chatGPT it, you will receive 0 for all parts of this project immediately.
Measures that we take to detect plagiarism
Teaching assistants have been instructed to report to the professor any suspicion of plagiarism
they find when they mark assignments.
If plagiarism has been detected in any part or in the whole assignment, the professor will take
appropriate measures. Recall that it is equally bad to copy a solution and to let someone else
請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp












 

標簽:

掃一掃在手機打開當前頁
  • 上一篇:AI6126代做、Python設計程序代寫
  • 下一篇:代做ICS4U、代寫 java 程序語言
  • 無相關(guān)信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風景名勝區(qū)
    昆明西山國家級風景名勝區(qū)
    昆明旅游索道攻略
    昆明旅游索道攻略
  • NBA直播 短信驗證碼平臺 幣安官網(wǎng)下載 歐冠直播 WPS下載

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

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

    狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线
  • <dl id="akume"></dl>
  • <noscript id="akume"><object id="akume"></object></noscript>
  • <nav id="akume"><dl id="akume"></dl></nav>
  • <rt id="akume"></rt>
    <dl id="akume"><acronym id="akume"></acronym></dl><dl id="akume"><xmp id="akume"></xmp></dl>
    亚洲精品久久久中文字幕| 日韩精品视频久久| 欧美一级特黄a| 亚洲精品无码久久久久久| 91九色丨porny丨国产jk| 青青在线视频免费观看| 亚洲熟妇无码av在线播放| 在线观看污视频| 四虎成人在线播放| 欧美精品久久96人妻无码| 国产在线无码精品| 国产高清www| 久草资源站在线观看| 久久国产精品视频在线观看| 欧美狂野激情性xxxx在线观| www.成年人视频| 国产三区在线视频| 一级黄色特级片| 福利在线小视频| 各处沟厕大尺度偷拍女厕嘘嘘| 国产a级一级片| 亚洲色图欧美自拍| 国产毛片久久久久久国产毛片| 男人插女人视频在线观看| 国产精品人人妻人人爽人人牛| 国产精品久久久毛片| 亚洲自拍偷拍一区二区三区| 日韩精品视频在线观看视频| av免费网站观看| 女同性恋一区二区| 日韩av在线综合| 亚洲小视频在线播放| 久久久久久久久久久免费视频| 手机在线免费毛片| 欧美牲交a欧美牲交aⅴ免费下载| 黄色a级三级三级三级| 欧美一区二区视频在线播放| 91日韩视频在线观看| 黄黄视频在线观看| 亚洲综合色在线观看| 日本国产在线播放| 懂色av一区二区三区四区五区| 国内外免费激情视频| 欧美大黑帍在线播放| 性欧美1819| 日韩a在线播放| 福利在线一区二区| 网站在线你懂的| 尤蜜粉嫩av国产一区二区三区| 欧美国产日韩激情| 精品一区二区成人免费视频| 91亚洲精品久久久蜜桃借种| 男人天堂999| 欧美 国产 综合| 亚洲精品无码国产| 黄色成人在线免费观看| 日韩欧美中文在线视频| 热久久久久久久久| 在线观看免费不卡av| 日韩在线第三页| 99蜜桃臀久久久欧美精品网站| 国产精品无码人妻一区二区在线| 日本高清视频免费在线观看| 国产精品中文久久久久久| 毛片毛片毛片毛| 网站一区二区三区| 天天干天天综合| 三区视频在线观看| 青娱乐国产精品视频| 黄黄视频在线观看| 日韩黄色片在线| 免费无遮挡无码永久视频| 少妇性饥渴无码a区免费| 日日摸日日碰夜夜爽无码| 日韩少妇内射免费播放18禁裸乳| 18岁网站在线观看| av免费网站观看| 最近中文字幕一区二区| 国产福利精品一区二区三区| 4444在线观看| 免费欧美一级视频| 国产精品视频分类| 看全色黄大色大片| 乱妇乱女熟妇熟女网站| 亚洲 激情 在线| www国产无套内射com| 欧美 日本 亚洲| jizzzz日本| 日韩国产一级片| 久久精品网站视频| 中文字幕一区二区三区四区五区人| 日本精品福利视频| www.日日操| 欧美国产视频一区| 999精品视频在线| 女人床在线观看| 一区二区三区网址| 久久久性生活视频| 五月激情婷婷在线| 中文字幕无码精品亚洲资源网久久| 人妻精品无码一区二区三区| 色婷婷激情视频| 久久精品99国产| 国产乱人伦精品一区二区三区| 欧美成人黑人猛交| 精品一区二区三区无码视频| 一道本在线免费视频| 欧美激情视频免费看| 中文字幕剧情在线观看| jizzjizzxxxx| 日本免费成人网| 香蕉精品视频在线| 香港日本韩国三级网站| 久久久免费视频网站| 欧美午夜性视频| 成人午夜免费剧场| 欧美在线a视频| 五月天婷婷激情视频| 久久久久久久久久久99| 菠萝蜜视频在线观看入口| 亚洲精品综合在线观看| 久久精品免费网站| 99久久久无码国产精品6| 欧美在线一区视频| 黄网站色视频免费观看| 中文字幕乱码免费| 日本三日本三级少妇三级66| 超碰超碰在线观看| 欧美在线aaa| www.久久91| 超碰成人在线播放| 亚洲精品永久视频| 欧美 另类 交| 成人手机在线播放| 日韩在线观看a| 欧美视频在线观看视频 | 黄色aaaaaa| 激情 小说 亚洲 图片: 伦| 亚洲视频在线观看一区二区三区| 男人舔女人下面高潮视频| 99视频在线免费播放| 国产精品97在线| 在线观看av日韩| 手机在线免费毛片| 肉大捧一出免费观看网站在线播放| 日本三级中文字幕在线观看| 中文字幕第50页| 国产成人在线小视频| 亚洲乱码中文字幕久久孕妇黑人| 999香蕉视频| 视频在线观看免费高清| 99热一区二区三区| 国产中文字幕二区| 久久久久久久片| 精品国产三级a∨在线| 大伊香蕉精品视频在线| 男女啪啪网站视频| 久久最新免费视频| 免费观看精品视频| 一区二区三区日韩视频| 欧美视频在线免费播放| 深夜黄色小视频| 成人免费视频91| 欧美成人手机在线视频| 亚洲熟妇无码一区二区三区| 日韩av片网站| 成人一区二区免费视频| 午夜免费高清视频| 亚洲精品蜜桃久久久久久| 日韩av在线中文| 青青草精品视频在线| 免费不卡av网站| 国产精品天天av精麻传媒| 91嫩草国产丨精品入口麻豆| 欧美国产日韩在线播放| www.亚洲成人网| 国产免费色视频| 国产aaaaa毛片| 激情网站五月天| 婷婷五月综合缴情在线视频| 亚洲无在线观看| 成人亚洲精品777777大片| 免费 成 人 黄 色| 中国老女人av| 性生生活大片免费看视频| 欧美黄色一级片视频| 男人日女人视频网站| 日本一道在线观看| 青春草在线视频免费观看| 91香蕉视频污版| 亚欧在线免费观看| 不要播放器的av网站| 欧美亚洲国产成人| 免费不卡av在线| 男人添女荫道口图片| 男人天堂av片| 日本手机在线视频| 波多野结衣综合网| 成人一对一视频| 国产精品亚洲a|