Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi all, I\'m having a problem with a MATLAB coding assignment thatinvolves histo

ID: 2954457 • Letter: H

Question

Hi all,
I'm having a problem with a MATLAB coding assignment thatinvolves histograms, so perhaps the statistics buffs can help meout.
Essentially, I'm given an image with N pixels, and I need toclassify the pixels into 8 bins. I have a vector, m, which is a N x1 vector, where the jth element of m gives a value between 1 and8^3 (i.e. 512) that uniquely identifies that pixels color. Inshort, I have a vector m where each element tells me a certainpixel's color.
How do I create an 8-bin histogram of the probabilities ofcertain colors occurring. Here is the MATLAB code I've tried, forthose interested.
theta = histc(m,1:8^3); where m is the vector of pixel colorvalues mentioned before. After that, I just divide every element in theta by the numberof pixels in the image to get the probabilities.
I'm having a problem with a MATLAB coding assignment thatinvolves histograms, so perhaps the statistics buffs can help meout.
Essentially, I'm given an image with N pixels, and I need toclassify the pixels into 8 bins. I have a vector, m, which is a N x1 vector, where the jth element of m gives a value between 1 and8^3 (i.e. 512) that uniquely identifies that pixels color. Inshort, I have a vector m where each element tells me a certainpixel's color.
How do I create an 8-bin histogram of the probabilities ofcertain colors occurring. Here is the MATLAB code I've tried, forthose interested.
theta = histc(m,1:8^3); where m is the vector of pixel colorvalues mentioned before. After that, I just divide every element in theta by the numberof pixels in the image to get the probabilities.

Explanation / Answer

What i understand from your code is that you you need somekind of a histogram of different color occurenceprobabilities If possible sort m before hand using sort(m) so that the finalgraph is in some order the command that you should be using is theta =hist(m,8^3); Instead of histc this will count the occurrence of different colors in terms ofvalues from 1 :8^3 and then divide by the number of pixels to obtain therespective probability.
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote