I am using this RGB2Lab code to convert my RGB image to Lab image.Naturally,there are some negative values in lab color image. When I try to plot histogram of lab image channels negative pixel values are ignored and I am only getting the histogram in 0-255 range.But it is stated in link that range of L 0-100 , a and b is -110 to 110. How can I get lab color space histogram correctly ?
UPDATE : Anders answer is nice,that was something similar to answer I expected.In his solution , the histogram
function opens a figure to show histogram which make it slower in the case of calculating histogram of each frame of the video.
This does not happen. You are probably using a wrong function.
Look at the example of how to make an histogram
% Create data from -100 to 1000
data=rand(1000,1)*200-100;
If you are using a version of MATLAB before 2014b then
hist(data);
if it is newer then
histogram(data);
This will output:
As you see, the values in the histogram go from -100 to 100, the range of the data.
If you don't want to plot anything, then use the hist
version, and get the counts and centers by doing [count,center]=hist(data)
.