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

ddimage_Filter.cpp

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission :
00003         Realtime Vision Processing System
00004 
00005     Copyright (C) 2005 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008 
00009     Copyright (C) 2005 Mike Baker
00010 
00011     This file is part of Phission.
00012 
00013     Phission is free software; you can redistribute it and/or modify
00014     it under the terms of the GNU Lesser General Public License as published by
00015     the Free Software Foundation; either version 2 of the License, or
00016     (at your option) any later version.
00017 
00018     Phission is distributed in the hope that it will be useful,
00019     but WITHOUT ANY WARRANTY; without even the implied warranty of
00020     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021     GNU Lesser General Public License for more details.
00022 
00023     You should have received a copy of the GNU Lesser General Public License
00024     along with Phission; if not, write to the Free Software
00025     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 
00027  ---------------------------------------------------------------------------*/
00028 #ifdef HAVE_CONFIG_H
00029     #include <phissionconfig.h>
00030 #endif
00031 
00032 #include <phStandard.h>
00033 
00034 #include <ddimage_Filter.h>
00035 
00036 #include <phError.h>
00037 #include <phMemory.h>
00038 #include <phPrint.h>
00039 
00040 #define DDIMAGE_FRAME_COUNT 3
00041 
00042 /* ----------------------------------------------------------------------- */
00043 ddimage_Filter::ddimage_Filter( uint32_t threshold, 
00044                                 uint32_t stride,
00045                                 uint32_t pixel_threshold,
00046                                 uint32_t block_filter ) : 
00047     phFilter("ddimage_Filter")
00048 {
00049     phFUNCTION("ddimage_Filter::ddimage_Filter")
00050     
00051     this->m_format          = phImageGRAY8;
00052     
00053     this->m_threshold       = threshold;
00054     this->m_pixel_threshold = pixel_threshold;
00055     this->m_block_filter    = ddimage_BlockKernel;
00056     this->m_stride          = 0;
00057     this->m_domask          = 1;
00058 
00059     this->m_history         = NULL;
00060     this->m_history_size    = NULL;
00061     this->m_history_count   = 0;
00062     
00063     this->m_diff            = NULL;
00064     this->m_diff_size       = 0;
00065     this->m_diff_count      = 0;
00066     this->m_diff_index      = 0;
00067     
00068     this->m_temp_frame      = NULL;
00069     this->m_temp_frame_size = 0;
00070     
00071     this->m_mask            = NULL;
00072     this->m_mask_size       = 0;
00073     this->m_mask_image      = new phImage();
00074 
00075     this->set(threshold,stride,pixel_threshold,block_filter);
00076     
00077 error:
00078     return;
00079 }
00080 
00081 /* ----------------------------------------------------------------------- */
00082 ddimage_Filter::~ddimage_Filter() 
00083 {
00084     phFUNCTION("ddimage_Filter::~ddimage_Filter")
00085     uint32_t x = 0;
00086     for (x = 0; x < this->m_stride; x++ )
00087     {
00088         phFree(this->m_history[x]);
00089         phFree(this->m_diff[x]);
00090     }
00091     phFree(this->m_history);
00092     phFree(this->m_diff);
00093     
00094     phFree(this->m_history_size);
00095     phFree(this->m_diff_size);
00096     
00097     phFree(this->m_temp_frame);
00098     phDelete(this->m_mask_image);
00099     phFree(this->m_mask);
00100 }
00101 
00102 /* ----------------------------------------------------------------------- */
00103 int ddimage_Filter::get(uint32_t *threshold, 
00104                         uint32_t *stride,
00105                         uint32_t *pixel_threshold,
00106                         uint32_t *block_filter )
00107 {
00108     phFUNCTION("ddimage_Filter::get")
00109     int locked = 0;
00110 
00111     phTHIS_LOOSE_LOCK(locked);
00112     
00113     if (threshold != NULL)
00114         *threshold = this->m_threshold;
00115     
00116     if (stride != NULL)
00117         *stride = this->m_stride;
00118     
00119     if (pixel_threshold != NULL)
00120         *pixel_threshold = this->m_pixel_threshold;
00121     
00122     if (block_filter != NULL)
00123         *block_filter = this->m_block_filter;
00124     
00125     phTHIS_LOOSE_UNLOCK(locked);
00126 
00127     return phSUCCESS;
00128 }
00129 
00130 /* ----------------------------------------------------------------------- */
00131 int ddimage_Filter::setThreshold( uint32_t threshold )
00132 {
00133     phFUNCTION("ddimage_Filter::setThreshold")
00134     int locked = 0;
00135 
00136     phTHIS_LOOSE_LOCK(locked);
00137 
00138     if (threshold > 255)
00139         threshold = 255;
00140     this->m_threshold       = threshold;
00141     
00142     phTHIS_LOOSE_UNLOCK(locked);
00143 
00144     return phSUCCESS;
00145 }
00146 
00147 /* ----------------------------------------------------------------------- */
00148 int ddimage_Filter::setStride( uint32_t stride )
00149 {
00150     phFUNCTION("ddimage_Filter::setStride")
00151     int locked = 0;
00152     uint8_t   **temp_history_array  = NULL;
00153     uint32_t   *temp_history_size   = NULL;
00154     uint8_t   **temp_diff_array     = NULL;
00155     uint32_t   *temp_diff_size      = NULL;
00156     uint32_t    i                   = 0;
00157     uint32_t    copy_stride         = 0;
00158     uint32_t    copy_index          = 0;
00159 
00160     phTHIS_LOOSE_LOCK(locked);
00161 
00162     if (stride < 1) stride = 1;
00163     
00164     /* If the history array has already been allocated, 
00165      * adjust the size of it accordingly but first hold onto the old pointers so
00166      * we don't lose already buffered information */
00167     if ((this->m_history        != NULL) && 
00168         (this->m_history_size   != NULL) && 
00169         (this->m_diff           != NULL) && 
00170         (this->m_diff_size      != NULL) &&
00171         (this->m_stride         != stride))
00172     {
00173         /* Store the buffer pointers and size values */
00174         temp_history_array  = this->m_history;
00175         temp_history_size   = this->m_history_size;
00176         temp_diff_array     = this->m_diff;
00177         temp_diff_size      = this->m_diff_size;
00178     
00179         /* Reallocate the history/diff buffers for the new stride */
00180         this->m_history = (uint8_t **)phCalloc(sizeof(uint8_t *),
00181                                                 stride);
00182         phPRINT_PTR(this->m_history,"phCalloc","phCalloc failed");
00183         
00184         this->m_history_size = (uint32_t *)phCalloc(sizeof(uint32_t),
00185                                                     stride);
00186         phPRINT_PTR(this->m_history_size,"phCalloc","phCalloc failed");
00187             
00188         this->m_diff = (uint8_t **)phCalloc(sizeof(uint8_t *),
00189                                             stride);
00190         phPRINT_PTR(this->m_diff,"phCalloc","phCalloc failed");
00191         
00192         this->m_diff_size = (uint32_t *)phCalloc(sizeof(uint32_t),
00193                                                  stride);
00194         phPRINT_PTR(this->m_diff_size,"phCalloc","phCalloc failed");
00195             
00196         /* If the stride is larger than the last one, then we have 'm_stride'
00197          * number of frames already buffered */
00198         if (this->m_stride <= stride)
00199         {
00200             this->m_history_count = this->m_stride;
00201             copy_index = 0;
00202             copy_stride = this->m_stride;
00203 
00204             /* Initialize the array locations that won't be over written */
00205             for (i = this->m_stride; i < stride; i++ )
00206             {
00207                 this->m_history[i]      = NULL;
00208                 this->m_history_size[i] = 0;
00209                 this->m_diff[i]         = NULL;
00210                 this->m_diff_size[i]    = 0;
00211             }
00212         }
00213         /* Otherwise, we're going to remove the oldest frames and only keep
00214          * 'stride' number of buffers */
00215         else
00216         {
00217             this->m_history_count   = stride;
00218             copy_index              = this->m_stride - stride;
00219             copy_stride             = stride;
00220 
00221             /* Free the buffers that won't be kept */
00222             for (i = 0; i < copy_index; i++ )
00223             {
00224                 phFree(temp_history_array[i]);
00225                 temp_history_size[i] = 0;
00226                 phFree(temp_diff_array[i]);
00227                 temp_diff_size[i] = 0;
00228             }
00229         }
00230 
00231         /* Any of the empty entries will be allocated when
00232          * ddimage_Filter::filter is executed 
00233          */
00234         /* This is just copying pointer arrays and the size arrays that have
00235          * the size of the buffers */
00236         phMemcpy(this->m_history,&(temp_history_array[copy_index]),
00237                 sizeof(uint8_t *) * copy_stride);
00238         phMemcpy(this->m_history_size,&(temp_history_size[copy_index]),
00239                 sizeof(uint32_t) * copy_stride);
00240         phMemcpy(this->m_diff,&(temp_diff_array[copy_index]),
00241                 sizeof(uint8_t *) * copy_stride);
00242         phMemcpy(this->m_diff_size,&(temp_diff_size[copy_index]),
00243                 sizeof(uint32_t) * copy_stride);
00244 
00245         phFree(temp_history_array);
00246         phFree(temp_history_size);
00247         phFree(temp_diff_array);
00248         phFree(temp_diff_size);
00249         
00250         /* Finally save the new stride */
00251         this->m_stride = stride;
00252 
00253         /* This logically resets the difference buffer because any of the saved
00254          * computations will be recomputed now that m_diff_count == 0 */
00255         this->m_diff_count = 0;
00256         /* Erase the buffers */
00257         for (i = 0; i < copy_stride; i++ )
00258             phMemset(this->m_diff[i],0,this->m_diff_size[i]);
00259     }
00260     else
00261     {
00262         this->m_stride = stride;
00263         
00264         if (this->m_history == NULL)
00265         {
00266             this->m_history = (uint8_t **)phCalloc(sizeof(uint8_t *),
00267                                                    this->m_stride);
00268             phPRINT_PTR(this->m_history,"phCalloc","phCalloc failed");
00269         }
00270         if (this->m_history_size == NULL)
00271         {
00272             this->m_history_size = (uint32_t *)phCalloc(sizeof(uint32_t),
00273                                                         this->m_stride);
00274             phPRINT_PTR(this->m_history_size,"phCalloc","phCalloc failed");
00275         }
00276         if (this->m_diff == NULL)
00277         {
00278             this->m_diff = (uint8_t **)phCalloc(sizeof(uint8_t *),
00279                                                 this->m_stride);
00280             phPRINT_PTR(this->m_diff,"phCalloc","phCalloc failed");
00281         }
00282         if (this->m_diff_size == NULL)
00283         {
00284             this->m_diff_size = (uint32_t *)phCalloc(sizeof(uint32_t),
00285                                                      this->m_stride);
00286             phPRINT_PTR(this->m_diff_size,"phCalloc","phCalloc failed");
00287         }
00288     }
00289 
00290     phTHIS_LOOSE_UNLOCK(locked);
00291 
00292     return phSUCCESS;
00293 }
00294 
00295 /* ----------------------------------------------------------------------- */
00296 int ddimage_Filter::setPixelThreshold   ( uint32_t pixel_threshold  )
00297 {
00298     phFUNCTION("ddimage_Filter::setPixelThreshold")
00299     int locked = 0;
00300 
00301     phTHIS_LOOSE_LOCK(locked);
00302 
00303     if (pixel_threshold > 16)
00304         pixel_threshold = 16;
00305     this->m_pixel_threshold = pixel_threshold;
00306     
00307     phTHIS_LOOSE_UNLOCK(locked);
00308 
00309     return phSUCCESS;
00310 }
00311 
00312 /* ----------------------------------------------------------------------- */
00313 int ddimage_Filter::setBlockFilter      ( uint32_t block_filter     )
00314 {
00315     phFUNCTION("ddimage_Filter::setBlockFilter")
00316     int locked = 0;
00317 
00318     phTHIS_LOOSE_LOCK(locked);
00319     
00320     if ((block_filter != ddimage_BlockStandard) ||
00321         (block_filter != ddimage_BlockKernel))
00322         block_filter = ddimage_BlockKernel;
00323     this->m_block_filter    = block_filter;
00324     
00325     phTHIS_LOOSE_UNLOCK(locked);
00326 
00327     return phSUCCESS;
00328 }
00329     
00330 /* ----------------------------------------------------------------------- */
00331 int ddimage_Filter::set(uint32_t threshold, 
00332                         uint32_t stride,
00333                         uint32_t pixel_threshold,
00334                         uint32_t block_filter )
00335 {
00336     phFUNCTION("ddimage_Filter::set")
00337     int locked = 0;
00338 
00339     phTHIS_LOOSE_LOCK(locked);
00340 
00341     if (threshold > 255)
00342         threshold = 255;
00343     this->m_threshold       = threshold;
00344     
00345     if (pixel_threshold > 16)
00346         pixel_threshold = 16;
00347     this->m_pixel_threshold = pixel_threshold;
00348     
00349     if ((block_filter != ddimage_BlockStandard) ||
00350         (block_filter != ddimage_BlockKernel))
00351         block_filter = ddimage_BlockKernel;
00352     this->m_block_filter    = block_filter;
00353     
00354     this->setStride(stride);
00355     
00356     phTHIS_LOOSE_UNLOCK(locked);
00357 
00358     return phSUCCESS;
00359 }
00360 
00361 /* ----------------------------------------------------------------------- */
00362 phFilter *ddimage_Filter::cloneFilter() 
00363 { 
00364     phFUNCTION("ddimage_Filter::cloneFilter")
00365     int locked = 0;
00366     uint32_t threshold      = 0;
00367     uint32_t stride         = 0;
00368     uint32_t pixel_threshold= 0;
00369     uint32_t block_filter   = 0;
00370     ddimage_Filter *ddimage = NULL;
00371 
00372     phTHIS_LOOSE_LOCK(locked);
00373     
00374     threshold       = this->m_threshold;
00375     stride          = this->m_stride;
00376     pixel_threshold = this->m_pixel_threshold;
00377     block_filter    = this->m_block_filter;
00378     
00379     phTHIS_LOOSE_UNLOCK(locked);
00380     
00381     ddimage = new ddimage_Filter( threshold, stride, pixel_threshold,
00382                                   block_filter );
00383    
00384     return (phFilter *)ddimage;
00385 }
00386 
00387 /* ----------------------------------------------------------------------- */
00388 int ddimage_Filter::enableMotionMask( int enable )
00389 {
00390     phFUNCTION("ddimage_Filter::enableMotionMask")
00391     int locked = 0;
00392 
00393     phTHIS_LOOSE_LOCK(locked);
00394     
00395     this->m_domask = enable ? 1 : 0;
00396     
00397     phTHIS_LOOSE_UNLOCK(locked);
00398 
00399     return phSUCCESS;
00400 }
00401 
00402 /* ----------------------------------------------------------------------- */
00403 int ddimage_Filter::disableMotionMask( int disable )
00404 {
00405     phFUNCTION("ddimage_Filter::disableMotionMask")
00406     int locked = 0;
00407 
00408     phTHIS_LOOSE_LOCK(locked);
00409     
00410     this->m_domask = disable ? 0 : 1;
00411     
00412     phTHIS_LOOSE_UNLOCK(locked);
00413 
00414     return phSUCCESS;
00415 }
00416 
00417 /* ----------------------------------------------------------------------- */
00418 phImage *ddimage_Filter::getMaskImage() 
00419 { 
00420     return this->m_mask_image; 
00421 }
00422 
00423 /* ----------------------------------------------------------------------- */
00424 int ddimage_Filter::filter() 
00425 {
00426     phFUNCTION("ddimage_Filter::filter")
00427     
00428     uint32_t        i           = 0;
00429     uint32_t        j           = 0;
00430     const int32_t   threshold   = this->m_threshold;
00431     const uint32_t  sz          = this->width * 
00432                                   this->height * 
00433                                   this->depth; /* depth:1 */
00434     
00435     /* -----------------------------------------------------------------------
00436      * local variables are cheaper as they could potentially be stored
00437      * in an actual CPU register instead of RAM; this depends on how good the
00438      * compiler really is though. 
00439      * ---------------------------------------------------------------------- */
00440     /* use local variables, shouldn't write to RAM or Cache as much */
00441     int32_t     t1 = 0;
00442     int32_t     t2 = 0;
00443 
00444     uint8_t     *imgptr     = NULL;
00445     uint8_t     *lastptr    = NULL;
00446     uint8_t     *diffptr    = NULL;
00447     uint8_t     *tempptr    = NULL;
00448     uint32_t    tempsz      = 0;
00449     
00450     /*
00451     phPROGRESS("threshold:%u stride:%u pixthresh:%u block:%u\n",
00452                 this->m_threshold,
00453                 this->m_stride,
00454                 this->m_pixel_threshold,
00455                 this->m_block_filter);
00456      */
00457     /* phDALLOC_RESIZE will resize the buffer if necessary, but it won't erase
00458      * any of the data that may be in it like phDALLOC will */
00459     if (this->m_domask)
00460     {
00461         phDALLOC_RESIZE(this->m_mask,
00462                         this->m_mask_size,
00463                         sz,
00464                         uint8_t);
00465     }
00466     else
00467     {
00468         if (this->m_mask != NULL)
00469         {
00470             phFree(this->m_mask);
00471             this->m_mask_size = 0;
00472         }
00473         if (!this->m_mask_image->isNull())
00474             this->m_mask_image->reset();
00475     }
00476  
00477     /* Always make sure the buffers are large enough */      
00478     for (i = 0; i < this->m_stride; i++ )
00479     {
00480         phDALLOC_RESIZE(this->m_history[i],
00481                         this->m_history_size[i],
00482                         sz,
00483                         uint8_t);
00484 
00485         /* Saves the difference values from this loop for a future */
00486         phDALLOC_RESIZE((this->m_diff[i]),
00487                         (this->m_diff_size[i]),
00488                         sz,
00489                         uint8_t);
00490     }
00491 
00492     if (this->m_history_count < this->m_stride)
00493     {
00494         phMemcpy(this->m_history[this->m_history_count],
00495                  Image,
00496                  sz );
00497         this->m_history_count++;
00498         goto success;
00499     }
00500     
00501     /* We need some place to keep the current image data before writing to
00502      * it. We could save each pixel 1 by 1 back to history before we write
00503      * to Image, but it's faster to memcpy it all at once and swap pointers */
00504     phDALLOC_RESIZE(this->m_temp_frame,
00505                     this->m_temp_frame_size,
00506                     sz,
00507                     uint8_t);
00508     phMemcpy( this->m_temp_frame, Image, sz );
00509 
00510     imgptr  = Image;
00511     lastptr = this->m_history[0];
00512     diffptr = this->m_diff[this->m_diff_index];
00513         
00514     this->m_diff_index = (this->m_diff_index + 1) % this->m_stride;
00515 
00516     /* Initialize the difference buffers */
00517     if (this->m_diff_count < this->m_stride)
00518     {
00519         this->m_diff_count++;
00520     }
00521     
00522     for( j = 0; j < sz; j++, imgptr++, lastptr++, diffptr++ )
00523     {
00524         t1 = *diffptr;
00525         
00526         t2 = *lastptr - *imgptr;
00527         /* Make sure the values are positive */
00528         if (t2 < 0) t2 *= -1;
00529         /* If the variables are outside the 0-255 range and they're positive,
00530          * they will always be grater than threshold and be set to 255 */
00531         t2 = ( t2 >= threshold ? 255 : 0 );
00532         
00533         /* Save the difference value into the m_diff buffer for the 
00534          * next loop around; do this after thresholding t2 */
00535         *diffptr = t2;
00536         
00537         /* Save the motion calculation into the output "Image" buffer */
00538         *imgptr = (uint8_t)(t1 & t2);
00539 
00540         /* make non-moving pixels progressively whiter */
00541         if (this->m_domask)
00542         {
00543             if( ! *imgptr ) 
00544             {
00545                 if( m_mask[j] < 255 ) m_mask[j]++;
00546             }
00547             /* If there is motion in the pixel, reset the mask to zero */
00548             else 
00549                 m_mask[j] = 0;
00550         }
00551     }
00552 
00553     if (this->m_domask)
00554     {
00555         rc = this->m_mask_image->setImage(width,height,format,0,m_mask);
00556         phCHECK_RC(rc,NULL,"this->m_mask_image->setImage()");
00557     }
00558 
00559     /* Hold on to the first frame in the history buffer list or we'll lose
00560      * it in the for loop if stride > 1 */
00561     tempptr             = this->m_history[0];
00562     tempsz              = this->m_history_size[0];
00563     
00564     /* Shift the frames in the history array */
00565     /* We shift the frames so that we don't have to maintain an index variable
00566      * and continually modulus the value. In addition, this permits the changing
00567      * of the stride value during runtime and maintaining some of the saved
00568      * frames if necessary */
00569     for (i = 0; i < (this->m_stride - 1); i++ )
00570     {
00571         this->m_history     [i]  = this->m_history      [i+1];
00572         this->m_history_size[i]  = this->m_history_size [i+1];
00573     }
00574     
00575     /* Swap the pointers */
00576     this->m_history      [(this->m_stride - 1)] = this->m_temp_frame;
00577     this->m_history_size [(this->m_stride - 1)] = this->m_temp_frame_size;
00578     /* The next loop around m_temp_frame will be replaced with the current input 
00579      * frame */
00580     this->m_temp_frame      = tempptr;
00581     this->m_temp_frame_size = tempsz;
00582    
00583     /* if no pixel count was given, then don't do the 4x4 noise suppression */
00584     if (this->m_pixel_threshold > 0)
00585     {
00586         /* The number of columns/pixels to move the kernel right each 
00587          * iteration */
00588         const uint32_t kernel_width_step = 
00589             (this->m_block_filter == ddimage_BlockStandard) ? 4 : 1;
00590         const uint32_t pixel_size               = sizeof(uint8_t)*this->depth;
00591         const uint32_t kernel_pixel_width_size  = pixel_size*4;
00592         uint32_t    count   = 0;
00593         uint32_t    pixel   = 0;
00594         uint8_t     val     = 0;
00595         
00596         
00597         /* 4x4 pixel blocks */
00598         /* This 4x4 block could be coded using loops, but it's unrolled here
00599          * so it could potentially be faster */
00600         //for (i = 0; i < (this->height - 3); i += 4 )
00601         for (i = 0; i < (this->height - 3); i += kernel_width_step )
00602         {
00603             for (j = 0; j < (this->width - 3); j += kernel_width_step)
00604             {
00605                 count = 0;
00606                 pixel = (i * this->width + j);
00607                 /* Can more optimizations can be done here? yes */
00608                 if (Image[pixel]) count++;  pixel++;
00609                 if (Image[pixel]) count++;  pixel++;
00610                 if (Image[pixel]) count++;  pixel++;
00611                 if (Image[pixel]) count++;
00612                 pixel += (this->width - 3);
00613                 if (Image[pixel]) count++;  pixel++;
00614                 if (Image[pixel]) count++;  pixel++;
00615                 if (Image[pixel]) count++;  pixel++;
00616                 if (Image[pixel]) count++;
00617                 pixel += (this->width - 3);
00618                 if (Image[pixel]) count++;  pixel++;
00619                 if (Image[pixel]) count++;  pixel++;
00620                 if (Image[pixel]) count++;  pixel++;
00621                 if (Image[pixel]) count++;
00622                 pixel += (this->width - 3);
00623                 if (Image[pixel]) count++;  pixel++;
00624                 if (Image[pixel]) count++;  pixel++;
00625                 if (Image[pixel]) count++;  pixel++;
00626                 if (Image[pixel]) count++;
00627 
00628                 val = (count >= this->m_pixel_threshold) ? 255 : 0;
00629 
00630                 /* if this is the far right of the image, then set the rest of
00631                  * the block's pixels to val this one time */
00632                 if ((j == (this->width  - 4)) || 
00633                     (i == (this->height - 4)) || 
00634                     (this->m_block_filter == ddimage_BlockStandard))
00635                 {
00636                     /* Set the entire area covered by the kernel window 
00637                      * to val */
00638                     pixel = (i * this->width + j);
00639                     phMemset(&Image[pixel],val,kernel_pixel_width_size);
00640                     pixel += this->width;
00641                     phMemset(&Image[pixel],val,kernel_pixel_width_size);
00642                     pixel += this->width;
00643                     phMemset(&Image[pixel],val,kernel_pixel_width_size);
00644                     pixel += this->width;
00645                     phMemset(&Image[pixel],val,kernel_pixel_width_size);
00646                 }
00647                 /* otherwise, only set the left most pixels */
00648                 else
00649                 {
00650                     pixel = (i * this->width + j);
00651                     phMemset(&Image[pixel],val,pixel_size);
00652                     #if 0
00653                     pixel += this->width;
00654                     phMemset(&Image[pixel],val,pixel_size);
00655                     pixel += this->width;
00656                     phMemset(&Image[pixel],val,pixel_size);
00657                     pixel += this->width;
00658                     phMemset(&Image[pixel],val,pixel_size);
00659                     #endif
00660                 }
00661             } /* for (j = 0; j < (this->width - 3); j += kernel_width_step ) */
00662         } /* for (i = 0; i < (this->height - 3); i += 4 ) */
00663     } /* if (this->m_pixel_threshold > 0) */
00664     
00665 success:
00666     return phSUCCESS;
00667 error:
00668     return phFAIL;
00669 }
00670 
00671 




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:09 2007 for phission by  doxygen 1.4.4