Two solutions were found by my students to display the histogram of a grayscale (or indexed) image.
The first solution is a code written by Jeric
//Jeric Tugaff
//Histogram
im=imread('grayscale.jpg'); //opens a 24 bit image
im=im(:,:,1);imwrite(im(:,:), 'gs.jpg'); //converts to 8 bit grayscale
imageim=imread('gs.jpg');
val=[];
num=[];
counter=1;
for i=0:1:255
[x,y]=find(im==i); //finds where im==i
val(counter)=i; num(counter)=length(x); //find how many pixels of im have value of i
counter=counter+1;end
plot(val, num); //plot. :)
The second was found by Jorge, a built-in function
histplot([0:1:255],c);
where c is the image variable.
Deposited in this blog are snippets of technical knowledge i'd like to refer back to from time to time.
Tuesday, June 24, 2008
Saturday, June 14, 2008
Collective comments on Activity 1 AP 186
AP 186 08-09 Class:
Most of you got the technique right. 10 point for those with correct reconstruction. 11 points for those with convincing overlays. There are a few who forgot the following important details, though:
1. The journal source - a number of you didn't cite what journal and paper they got the graphs from.
2. Collaborators - some of you forgot to mention who helped you. Please tell if you did it independently. Part of the learning is learning from each other. If you're not certain, ask around. If you're certain, share.
3. Details on how you got your graphs - some of you had no explanations.
4. Self-evaluation - remember you give your grade. If i think you got lower or higher than what you deserve I'll change it.
Most of you got the technique right. 10 point for those with correct reconstruction. 11 points for those with convincing overlays. There are a few who forgot the following important details, though:
1. The journal source - a number of you didn't cite what journal and paper they got the graphs from.
2. Collaborators - some of you forgot to mention who helped you. Please tell if you did it independently. Part of the learning is learning from each other. If you're not certain, ask around. If you're certain, share.
3. Details on how you got your graphs - some of you had no explanations.
4. Self-evaluation - remember you give your grade. If i think you got lower or higher than what you deserve I'll change it.
Subscribe to:
Posts (Atom)