SetPixel

Set the intensity of a pixel at a certain coordinate in the image.

 

function call:

[out_img1]=vsg('SetPixel',in_img1,p1,col);

 

Arguments:

in_img1 input image, can be 3 channel RGB, single channel greyscale, or binary image, can also be DICOM image.

p1 – An (x,y) coordinate of the pixel to be removed, specified as a 2-vector, e.g. [100;150].

col - the colour of the pixel to be drawn. This should be specified as a 3-vector e.g. [50;100;200].

 

Description:

[out_img1]=vsg('SetPixel',in_img1,p1,col) – out_img1 is an image of the same dimensions and number of colour planes as the input image, with the pixel at the specified position set to the specified colour.

 

Example:

img1 = openimage('lake.jpg');

[out_img1]=vsg('SetPixel',img1,[100,100],[255,0,0]);

figure, image(uint8(out_img1));

 

Notes:

For single colour plane images, the first value of the RGB triplet will be used. Also, if this is used with DICOM images, the same pixel will be set on each slice of the dicom image.
Home       Functions       Back