Question
A two-dimensional (m x n) containing non-negative numbers between 0-255 (including 0 and 255) will be given to you in a txt file in the
A two-dimensional (m x n) containing non-negative numbers between 0-255 (including 0 and 255) will be given to you in a txt file in the LMS system. These numbers are pixel values in shades of gray images. The matrix that will be given to you is actually an image file.
2. Your goal is to group the "similar" numbers (pixels) given in this matrix and finally collect the groups and the matrix elements of these groups together. The similarity of the numbers is explained below. From now on, pixel and number are used synonymously.
3. When grouping, you should consider the "neighborhood" ones. Here, consider the neighborhood as a neighborhood of 4. That is, numbers to the left, right, above, and below (if applicable) of a number can be neighbors (the diagonal ones are not included in the neighbor relationship).
4. The "edge size" between any two neighboring pixels is the absolute difference between these two numbers.
is the value. 5. As can be seen from the definition above, this matrix (image) can be compared to a graphic i structure. It can be assumed that the nodes are pixels and the difference between them is the edge "size".
6. Initially, assume that each pixel is only in its group, G. That is, let there be m x n groups.
7. Minimum Spanning Tree as needed for each group G.
You will calculate [MST]). The InDifference function is the largest side of the MST of each group:
IcDifference (G)=max e EMST (GE)w(e)
8. The difference between the two groups, the Difference(G1,G2), is the smallest side that connects these two groups. If there is no edge connecting these two groups together, the difference is infinite or greater than the largest possible edge.
Difference (G1,G)=
min VEGI, vje G2
w(vi, vj)
9. The two groups G1 and G2 are separate from each other (not to be combined) if the difference between the two groups is Difference (G1,G2)> MinlDifferential (G1,G2). Otherwise, these two groups G1 and G2 should be combined. Minic Fork (G1,G2) = min (ic Fork (G1) + T(G), ic Fork (63)+ T (6)) T(G) = Represents the number of members of the IGI group. k is a constant. 6) Use as G) 300.
10. The creation of groups, additions, whether any number (node) belongs to a group should be done as we discussed in the lesson. It is explained below. Create an array as long as the element in the matrix. The indices of this array represent the positions of the numbers in the matrix. represents. In other words, for a matrix with M rows and N columns, a length MxN
could be used. You might think that 3 speeds things up.
Consider the descriptions 1 to 10 above with these graphs (and sequence representation). For example, we should be able to find the MST of the group 3,4, 8, and 9. Of course, the weights of the edges are not given here. After calculating the edge weights, the MST can be found.
The purpose of the figures given above is another example of how a graphical data structure can be expressed as an array for this particular problem. We have seen another example before in "priority queues".
Above, we see that there are 6 groups such as 0, 1-2, 3-4-8-9, 5,6,7 (with in-group elements, groups separated from each other by (comma)) from the latest version of the graphic and series presentation. The purpose of the steps described in 1-10 is to create such groups. After groups are formed
we will convert the numbers belonging to the group within the group to a "color". For example group 0 (GO) is red, group 1
(G1) will be converted to colors like blue etc.... Then each group selects pixels of its own color.
will make the actual groups (segments) of the image visible. Program that paints pixels
will be given to you.
The pseudocode of the algorithm is given below:
1. Arrange all the sides k,k2....,kp from smallest to largest (k-k-...
1. Let s, and sy be the two ends (numbers) of the side connected by ki. Let these two numbers be in groups G, and Gy (in two different groups).
2. If k
no action is taken (groups are not merged!).
4. At the end of the program, all groups were created.
The groups are colored and ready to paint.
What will be delivered:
1. All your code will be made into a pdf file and the following will be added to the end of this file and uploaded to the LMS system before the submission date for the interview. 2. Output of your program (running the program I gave you with the pixels you produced.
the resulting window) at the end of this pdf file. 3. Do not forget to add your name and which course is final at the beginning of the pdf file.
Arr 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 Balangta dizinin her bir elemani indeks saysn barndrr, herbir say kendi grubundadr. Sonrasnda 2 ve l'in birbirne benzer olduunu hesapladnz kabul edin. Aadaki resimler oluacaktr. 1 Grld gibi 2 says (dm) 1 saysna balanmtr (1 de 2 ye balanabilirdi). Aada bu durumun dizi iinde gsterimi verilmitir: Arr 0 1 1 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 Grld gibi 2 ve l birbirne balanmtr. Sonrasnda 3,4,8 ve 9 un birbirne benzedii hesaplanarak aadaki ekillerde gsterilmitir: 0 1 3 5 6 7 2. 9 4 8 Ve yukarda verilen bu sunumun dizide gsterimi: 3 Arr 0 1 1 3 5 6 7 33 0 1 2 3 4 5 6 7 8 9 8 saysnn 3 kanalyla gruba dahil edildii grlyor. Aslnda 8'in "parent"i olarak 4 deStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started