00001 /** 00002 * @file ImageBrightnessEstimator.cpp 00003 * 00004 * Implementation of class ImageBrightnessEstimator 00005 * This class estimates the overall image brightness 00006 * 00007 * @author <A href=mailto:mkunz@sim.tu-darmstadt.de>Michael Kunz</A> 00008 * @author <A href=mailto:brunn@sim.tu-darmstadt.de>Ronnie Brunn</A> 00009 */ 00010 00011 00012 #include "ImageBrightnessEstimator.h" 00013 00014 ImageBrightnessEstimator::ImageBrightnessEstimator(const SpecialVisionInterfaces& interfaces) 00015 : SpecialVision(interfaces) 00016 { 00017 } 00018 00019 void ImageBrightnessEstimator::execute() 00020 { 00021 unsigned int brightness=0; 00022 unsigned int counter=0; 00023 /*for (int x=image.cameraInfo.resolutionWidth/3; x<2*image.cameraInfo.resolutionWidth/3; x+=image.cameraInfo.resolutionWidth/36) 00024 { 00025 for (int y=image.cameraInfo.resolutionHeight/3; y<2*image.cameraInfo.resolutionHeight/3; y+=image.cameraInfo.resolutionHeight/36) 00026 {*/ 00027 for (int x=image.cameraInfo.resolutionWidth/12; x<image.cameraInfo.resolutionWidth; x+=image.cameraInfo.resolutionWidth/12) 00028 { 00029 for (int y=image.cameraInfo.resolutionHeight/12; y<image.cameraInfo.resolutionHeight; y+=image.cameraInfo.resolutionHeight/12) 00030 { 00031 counter++; 00032 brightness+=image.image[y][0][x]; 00033 } 00034 } 00035 00036 brightness/=counter; 00037 specialPercept.type = SpecialPercept::imageBrightness; 00038 specialPercept.estimatedImageBrightness = (unsigned char) brightness; 00039 }
1.3.6