The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ffimage.cpp

Go to the documentation of this file.
00001 /*
00002  *  ffimage.cpp
00003  *  
00004  *
00005  *  Created by Ian Fasel on Mon Nov 18 2002.
00006  *  Copyright (c) 2002 Machine Perception Laboratory
00007  *  University of California San Diego.
00008  *  Please read the disclaimer and notes about redistribution
00009  *  at the end of this file.
00010  *
00011  *  Authors: Ian Fasel, Bret Fortenberry
00012  */
00013 
00014 #include <stdio.h>
00015 #include "ffimage.h"
00016 #include "mpisearch.h"
00017 
00018 
00019 // A fast RGBTRIPLE to float converting copy constructor
00020 FFImage<float>::FFImage<float>(const FFImage< RGBTRIPLE > &source, int subs){
00021         if (subs < 1) subs = 1;
00022         setSize(static_cast<int>(source.width/subs),static_cast<int>(source.height/subs),FALSE);
00023         RGBTRIPLE *pix;
00024         float *dest_ptr = array;
00025         if(!source.isFlipped()){
00026                 for (int y=0; y < height; y++) {
00027                         pix = source.array + (y*subs * source.width);
00028                         for (int x = 0; x < width; x++, pix+=subs) {
00029                                 *dest_ptr++  = static_cast<float>( pix->rgbtRed*3 + pix->rgbtGreen*6 + pix->rgbtBlue );
00030                         }
00031                 }
00032         } else{
00033                 for (int y=height-1; y >= 0; y--) {
00034                         pix = source.array + (y*subs * source.width);
00035                         for (int x = 0; x < width; x++, pix+=subs) {
00036                                 *dest_ptr++  = static_cast<float>( pix->rgbtRed*3 + pix->rgbtGreen*6 + pix->rgbtBlue );
00037                         }
00038                 }
00039         }
00040 
00041 }
00042 
00043 /*
00044  * 
00045  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00046  * 
00047  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00048  *    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
00049  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00050  * 
00051  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00052  * 
00053  */
00054 
00055 

Generated on Mon Nov 8 17:07:33 2004 for MPT by  doxygen 1.3.9.1