Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
10
Task/Bitmap/Octave/bitmap-1.octave
Normal file
10
Task/Bitmap/Octave/bitmap-1.octave
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
im = zeros(W, H, 3, "uint8"); % create an RGB image of width W and height H
|
||||
% and intensity from 0 to 255; black (all zeros)
|
||||
im(:,:,1) = 255; % set R to 255
|
||||
im(:,:,2) = 100; % set G to 100
|
||||
im(:,:,3) = 155; % set B to 155
|
||||
im(floor(W/2), floor(H/2), :) = 0; % pixel in the center made black
|
||||
disp(im(floor(W/3), floor(H/3), :)) % display intensities of the pixel
|
||||
% at W/3, H/3
|
||||
p = im(40,40,:); % or just store it in the vector p, so that
|
||||
% p(1) is R, p(2) G and p(3) is B
|
||||
21
Task/Bitmap/Octave/bitmap-2.octave
Normal file
21
Task/Bitmap/Octave/bitmap-2.octave
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
function im = create_rgb_image(w, h)
|
||||
im = zeros(w, h, 3, "uint8");
|
||||
endfunction
|
||||
|
||||
function set_background(im, colorvector)
|
||||
im(:,:,1) = colorvector(1);
|
||||
im(:,:,2) = colorvector(2);
|
||||
im(:,:,3) = colorvector(3);
|
||||
endfunction
|
||||
|
||||
function set_pixel(im, coord, colorvector)
|
||||
im(coord(1), coord(2), 1) = colorvector(1);
|
||||
im(coord(1), coord(2), 2) = colorvector(2);
|
||||
im(coord(1), coord(2), 3) = colorvector(3);
|
||||
endfunction
|
||||
|
||||
function [r, g, b] = get_pixel(im, coord)
|
||||
r = im(coord(1), coord(2), 1)
|
||||
g = im(coord(1), coord(2), 2)
|
||||
b = im(coord(1), coord(2), 3)
|
||||
endfunction
|
||||
8
Task/Bitmap/Octave/bitmap-3.octave
Normal file
8
Task/Bitmap/Octave/bitmap-3.octave
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
%example
|
||||
im = create_rgb_image(200,200);
|
||||
for x = 1:128
|
||||
im = set_pixel(im, [x, x], [200, 50, 220]);
|
||||
endfor
|
||||
|
||||
% it seems like saveimage wants double class on [0,1]
|
||||
saveimage("image.ppm", double(im)./256, "ppm");
|
||||
Loading…
Add table
Add a link
Reference in a new issue