diff options
author | scuri <scuri> | 2011-04-05 02:35:09 +0000 |
---|---|---|
committer | scuri <scuri> | 2011-04-05 02:35:09 +0000 |
commit | ee3ab8e6551ed22aeffcbb75d89d0e2af0afc973 (patch) | |
tree | f8b910d5d1c3b17f41fb13f14a2a6817b646bef1 /src/process/im_arithmetic_bin.cpp | |
parent | b2257ad3263f1eaf8dcf637edb480e0c8274fd73 (diff) |
Fixed: imProcessMultipleMean when source images were data type byte.
Diffstat (limited to 'src/process/im_arithmetic_bin.cpp')
-rw-r--r-- | src/process/im_arithmetic_bin.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/process/im_arithmetic_bin.cpp b/src/process/im_arithmetic_bin.cpp index 575e650..a22e8cc 100644 --- a/src/process/im_arithmetic_bin.cpp +++ b/src/process/im_arithmetic_bin.cpp @@ -2,7 +2,7 @@ * \brief Binary Arithmetic Operations * * See Copyright Notice in im_lib.h - * $Id: im_arithmetic_bin.cpp,v 1.3 2010/01/08 03:49:05 scuri Exp $ + * $Id: im_arithmetic_bin.cpp,v 1.4 2011/04/05 02:35:10 scuri Exp $ */ @@ -580,6 +580,7 @@ void imProcessArithmeticConstOp(const imImage* src_image1, float value, imImage* void imProcessMultipleMean(const imImage** src_image_list, int src_image_count, imImage* dst_image) { const imImage* image1 = src_image_list[0]; + imImage* aux_image = NULL; int data_type = image1->data_type; if (image1->data_type == IM_BYTE) @@ -589,16 +590,26 @@ void imProcessMultipleMean(const imImage** src_image_list, int src_image_count, if (!acum_image) return; + if (image1->data_type == IM_BYTE) + aux_image = imImageCreate(image1->width, image1->height, image1->color_space, data_type); + for(int i = 0; i < src_image_count; i++) { const imImage *image = src_image_list[i]; - imProcessArithmeticOp(image, acum_image, acum_image, IM_BIN_ADD); /* acum_image += image */ - + if (aux_image) + { + imProcessUnArithmeticOp(image, aux_image, IM_UN_EQL); + imProcessArithmeticOp(aux_image, acum_image, acum_image, IM_BIN_ADD); /* acum_image += image */ + } + else + imProcessArithmeticOp(image, acum_image, acum_image, IM_BIN_ADD); /* acum_image += image */ } imProcessArithmeticConstOp(acum_image, float(src_image_count), dst_image, IM_BIN_DIV); imImageDestroy(acum_image); + if (aux_image) + imImageDestroy(aux_image); } void imProcessMultipleStdDev(const imImage** src_image_list, int src_image_count, const imImage *mean_image, imImage* dst_image) |