Quantcast

Octave grayscale image

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Octave grayscale image

klaus45
Hi

I have Octave 3.2.4.
I have been doing this for two weeks and still this doesn't work.

Grayscale values are like this:  places are between 0-255. So 0 is a lowest and 255 is a highest place.
x=255 is a width of the landscape. and y=255 is a depth.

I want to create a grayscale image that has above description for a
landscape, and that has a 200 pixel tall hemisphere in the middle.

Here is my solution:


a =  (200*rand(64));  
figure(1), image(a), colormap(gray)
title('newpicture')
imwrite(testing.jpg, a)

b = imread(testing.jpg);
figure(2), image(b), colormap(gray)
title('picture is loaded')



But this doesn't work and something is missing; x and y, in the middle.
I'm not sure about that 64. How can I do this?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Octave grayscale image

martin_helm
I am not exactly sure if I understand your question, but the first thing
which bugs me is the syntax you use for your imwrite. While I do not
remeber if it was different in 3.2 when I run your code in 3.6.1 and use
the following syntax it works to write the image

imwrite(uint8(a),"testing.jpg")

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Octave grayscale image

klaus45
Thanks.

I tried this:

a =  (200*rand(64));  
figure(1), image(a), colormap(gray)
title('newpicture')
imwrite(uint8(a),"testing.jpg")

b = imread(testing.jpg);
figure(2), image(b), colormap(gray)
title('picture is loaded')

- Good, it worked! I got a grayscale image!

grayscale values should be: 0 is a lowest place and 255 is a highest.
x=255 is a width of the landscape. y=255 is a depth.

Grayscale image should have that description above for a
landscape that has a 200 pixel tall hemisphere in the middle.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Octave grayscale image

klaus45
Can someone please help: how can I have these;

grayscale values should be: 0 is a lowest place and 255 is a highest.
x=255 is a width of the landscape. y=255 is a depth.

Grayscale image should have that description above for a
landscape that has a 200 pixel tall hemisphere in the middle.

Best wishes, Klaus
Loading...