⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addsub.c

📁 This is code tutorial for image processing include:histogram,sketon....
💻 C
字号:

   /***********************************************
   *
   *       file addsub.c
   *
   *       Functions: This file contains
   *          add_image_array
   *          subtract_image_array
   *
   *       Purpose:
   *          These functions implement
   *          image addition and subtraction.
   *
   *       External Calls:
   *          none
   *
   *       Modifications:
   *          1 April 1992 - created
   *
   *************************************************/

#include "cips.h"

     /*******************************************
     *
     *   add_image_array(...
     *
     *   This function adds two image arrays.
     *   The image array out_image will hold
     *   the result.
     *
     *******************************************/

add_image_array(the_image, out_image, rows, cols, max)
   int    rows, cols;
   short  **the_image,
          **out_image,
          max;
{
   int    i, j;

   for(i=0; i<rows; i++){
      for(j=0; j<cols; j++){
         out_image[i][j] = the_image[i][j] + 
                           out_image[i][j];
         if(out_image[i][j] > max)
            out_image[i][j] = max;
      }  /* ends loop over j */
   }  /* ends loop over i */

}  /* ends add_image_array */





     /*******************************************
     *
     *   subtract_image_array(...
     *
     *   This function subtracts two image arrays.
     *   The image array out_image will hold
     *   the result.
     *
     *******************************************/

subtract_image_array(the_image, out_image, rows, cols)
   int    rows, cols;
   short  **the_image,
          **out_image;
{
   int    i, j, length, width;

   for(i=0; i<rows; i++){
      for(j=0; j<cols; j++){
         out_image[i][j] = the_image[i][j] - 
                           out_image[i][j];
         if(out_image[i][j] < 0)
            out_image[i][j] = 0;
      }  /* ends loop over j */
   }  /* ends loop over i */

}  /* ends subtract_image_array */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -