[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating picture X*Y pixel by pixel
From: |
Martin Weiser |
Subject: |
Re: Creating picture X*Y pixel by pixel |
Date: |
Mon, 09 Aug 2010 20:32:01 +0200 |
User-agent: |
Internet Messaging Program (IMP) H3 (4.3.7) |
Cituji ZWD <address@hidden>:
Hello,
I want to create a picture e.g. 640x480 and want to be able to change the
color of each pixel.
So I want to create a picture pixel by pixel(and being able to say pixel on
235x198 has the color grey) and save it as a .jpg
Im a beginner in octave so any help would be great
Thanks
ZWD
--
View this message in context:
http://octave.1599824.n4.nabble.com/Creating-picture-X-Y-pixel-by-pixel-tp2318402p2318402.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Hello.
In octave, images are just matrices. Colour images are just 3 matrices
(one for red, one for green, one for blue) bundled together
(superimposed) into an 3D array.
So, create your matrices, eg. like this:
# prepare them
red=zeros(2,2)
green=zeros(2,2)
blue=zeros(2,2)
#"colour" pixels in them (0-255)
#red matrix
red(1,1)=100
#green
green(1,2)=150
#blue one
blue(2,2)=200
# bundle them together
fig=cat(3,red,green,blue)
# if you want to see that figure
image(fig)
# if you want to save it as jpeg
imwrite(fig, "some_image_name.jpg")
Simple, is not it?
If you need just a monochromatic (eg. white-gray-black) figure, you
need just a single matrix instead of 3D array.
So, I hope this helps.
Martin