Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to convert pixel value type to normal number type ?

Subject: How to convert pixel value type to normal number type ?

From: Le Tuan

Date: 8 Mar, 2012 09:29:24

Message: 1 of 2

I write:

I=imread('grayscale.jpg');
I(1,1)=255;
a=I(1,1)+1

Then a still equal 255, how to let a=256 (or how to assign G=I and let G is a normal number type for +,-,*,/,...).
Sorry because my English is bad. Thanks a lot !

Subject: How to convert pixel value type to normal number type ?

From: Nasser M. Abbasi

Date: 8 Mar, 2012 09:51:31

Message: 2 of 2

On 3/8/2012 3:29 AM, Le Tuan wrote:
> I write:
>
> I=imread('grayscale.jpg');
> I(1,1)=255;
> a=I(1,1)+1
>
> Then a still equal 255, how to let a=256 (or how to assign G=I
>and let G is a normal number type for +,-,*,/,...).
> Sorry because my English is bad. Thanks a lot !

help double() and watch for the class of the data you are reading
from help on imread.

EDU>> I=imread('a.jpg');
EDU>> I(1,1)
    69
EDU>> I(1,1)=300;
EDU>> I(1,1)

   255

EDU>> I=double(I);
EDU>> I(1,1)=300;
EDU>> I(1,1)

    300

--Nasser

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us