I’m new to Matlab and I want to make my own function that makes the same job as imhist(Displays histogram of image data) but I am a total newbie to this and I don’t have any clues how I’m going to develop such function..
I started making something but its very incomplete.
function [ output_args ] = myhist( x )
%MYHIST Summary of this function goes here
%Detailed explanation goes here
x=imread('flower.jpg');
imshow(x);
[c,d]=hist(x(:),0:1:255);
figure,plot(d,c);
figure,plot(c,d);
%figure,imhist(x);
end
I would be very grateful if you could give me any helpful tips..
Here is my attempt at implementing the IMHIST function. It does not handle all the cases that the official function does, but it should produce very similar results in most cases:
Let’s test it with a sample image:
Note how IMHIST is apparently adjusting the y-limit so as to deal with the two different peaks in the histogram.