Brightness and contrast

imadjust – change brightness or contrast in Matlab by percentage.

newImage = imadjust(originalImage, [a b], [c d]);

Where variables abc and d are between 0 and 1.

    • To decrease contrast: increase a
    • To increase contrast: decrease b
    • To increase brightness: increase c
    • To decrease brightness: decrease d

Here is full example increasing contrast by 20%:

originalImage = imread('img.tif');

 %show original image
title('Original Image');
contrastImage = imadjust(originalImage, [0 0.8], [0 1]);
 %show contrast image
title('Contrast Image');
increases the combination of brightness and contrast of the image: image(uint8(double(originalImage(:,:,:)) * 2));

mesh(double(cartman(:,:,3))); In this example, we are examining layer 3 = blue. Before meshing the image, we convert it to data type double.

To view thered intensity image and a corresponding intensity color bar, we issue: image(cartman(:,:,1)), colorbar;The first colon denotes all rows, the second colon all columns, and the third index denotes the color Red.

When I attempt to cluster my integer data using KMEANS, I receive the following error
??? Error using ==> minus
Integers can only be combined with integers of the same class, or scalar doubles.


This error is the expected behavior for passing an integer data type to the KMEANS function. KMEANS and many other statistical functions are not designed to work with integer data in MATLAB 7.2 (R2006a).

The only workaround is to convert the integer data to a double data type before passing it to KMEANS. For more information, refer the following documentation page on the DOUBLE function:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s




Just another site

Jing's Blog

Just another site

Start from here......







Just another site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision


Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness



Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: