[Index for tmp_for_tar/imgio] [Return to Master Index]

mergeppm

(tmp_for_tar/imgio/mergeppm.m)


Function Synopsis

im = mergeppm(r, g, b)

Help text

       im = mergeppm(r, g, b)

 mergeppm  Merge the images of the Red, Green, Blue components of a
           color image to a single image whose columns contain
           interleaved red, green, blue values (PPM style), i.e:
           1st column contains red values,
           2nd column contains green values,
           3rd column contains blue values,
           4th column contains the next column of red values,
           etc.

           [r g b] = splitppm(im)
           im - interleaved RGB values (in PPM style).
           r  - red component.
           g  - green component.
           b  - blue component.

 Created: 30.6.98.
 Version: 1.0



Listing of function file tmp_for_tar/imgio/mergeppm.m

##       im = mergeppm(r, g, b)
##
## Copyright (C) 1998 Ariel Tankus
## 
## This program is free software.
## This file is part of the Image Processing Toolbox for Octave
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
##

## mergeppm  Merge the images of the Red, Green, Blue components of a
##           color image to a single image whose columns contain
##           interleaved red, green, blue values (PPM style), i.e:
##           1st column contains red values,
##           2nd column contains green values,
##           3rd column contains blue values,
##           4th column contains the next column of red values,
##           etc.
##
##           [r g b] = splitppm(im)
##           im - interleaved RGB values (in PPM style).
##           r  - red component.
##           g  - green component.
##           b  - blue component.
##

## Author: Ariel Tankus <arielt@math.tau.ac.il>
## Created: 30.6.98.
## Version: 1.0

function im = mergeppm(r, g, b)

if ((size(r) ~= size(g)) | (size(g) ~= size(b)))
    error("Red, Green, Blue components must have identical dimensions.");
end

im = [r; g; b];
im = reshape(im, size(r, 1), 3*size(r, 2));

endfunction

Produced by oct2html on Sat Sep 14 9:47:03 2002
Cross-Directory links are: ON