You are on page 1of 2

to resizeanyMatlab code to C code Conversion.:to do this - 1) MAtlab code should be written in function format.

2) Script format will be used as test bench.


* when giving function file we will not write ;end; statement at the end. beacu
se when doing conversion converter will think that program has been ended.
Image processing:to read an indexed image. we read it in a matrix like [a b]=imread('images.tif
');
imshow(a,b)
to get info of the image which is at the workspace area (has been read) then us
e command imfinfo() eg.:1] imfinfo('indexed23.tif')
ans =
Filename:
FileModDate:
FileSize:
Format:
FormatVersion:
Left:
Top:
Width:
Height:
BitDepth:
ColorType:
FormatSignature:
BackgroundColor:
AspectRatio:
ColorTable:
Interlaced:
DelayTime:
DisposalMethod:

'C:\Users\Prakhar\Desktop\indexed23.tif'
'10-Feb-2015 11:49:04'
88566
'GIF'
'89a'
1
1
344
327
8
'indexed'
'GIF89a'
1
0
[256x3 double]
'no'
0
'DoNotspecify'

2] imfinfo('wall.jpg')
ans =
Filename:
FileModDate:
FileSize:
Format:
FormatVersion:
Width:
Height:
BitDepth:
ColorType:
FormatSignature:
NumberOfSamples:
CodingMethod:
CodingProcess:
Comment:
Orientation:
XResolution:

'C:\Users\Prakhar\Desktop\wall.jpg'
'20-Oct-2008 13:52:28'
184719
'jpg'
''
1024
768
24
'truecolor'
''
3
'Huffman'
'Sequential'
{}
1
72

YResolution:
ResolutionUnit:
Software:
DateTime:
YCbCrPositioning:
DigitalCamera:
ExifThumbnail:

72
'Inch'
'Adobe Photoshop CS2 Windows'
'2008:02:13 02:25:14'
'Centered'
[1x1 struct]
[1x1 struct]

Now, to know pixel information- we use command :g the image in figure windows.

impixelinfo after openin

to know the size of your image use the command :-

size()

Eg.:-

>> size(f)
ans =
768

1024

to resize any image use command :imresize(q,0.5)


0.5 means half size of the original image
so that 2 means dugna of original image.
To know pixel at a particular point then use.
>>impixel(w,220,40)

impixel(w,220,40)

eg.:

ans =
162

162

162

To add/remove anything in an image.we add or remove pixel:--2]

IMAGE ARITHMETIC:-

A] to add smthng in image use command:imadd(Image,Pixelvalue)


* adding pixel value will increase brightness.
*to add two images order must be same of the image matrix. use command imadd
(first image,second image)
*only same type of images could be added.but black and white and color a
re exceptions.
* adding doesn't depend on extension name
B] to substract images use command:- imsubtract(image,pixelvalues)
c] multiplying two images :lue) or immultiply(image1,image2)

use command :-

immultiply(image,pixelva

* multiplying with large pixel value will increase brightness in high amount .
.
eg. multiplying with 50 pixel value will make it a white image.
d] to divide an image we use comand :- imdivide(image,pixel value)
or
imdivide(image 1,image 2)

You might also like