Go to the documentation of this file.00001 #include "vpro_epipolar_space_process.h"
00002
00003
00004 #include <vcl_iostream.h>
00005 #include <vil1/vil1_memory_image_of.h>
00006 #include <vil1/vil1_rgb.h>
00007
00008 vpro_epipolar_space_process::vpro_epipolar_space_process()
00009 {
00010 }
00011
00012 vpro_epipolar_space_process::~vpro_epipolar_space_process()
00013 {
00014 }
00015
00016 bool vpro_epipolar_space_process::execute()
00017 {
00018 if (this->get_N_input_images() != 2)
00019 {
00020 vcl_cout << "In vpro_epipolar_space_process::execute() - not 2 input images\n";
00021 return false;
00022 }
00023
00024 vil1_memory_image_of<unsigned char> im0(vpro_video_process::get_input_image(0));
00025 vil1_memory_image_of<unsigned char> im1(vpro_video_process::get_input_image(1));
00026 vil1_memory_image_of<vil1_rgb<unsigned char> > im;
00027 unsigned width = im0.width(), height = im0.height();
00028 im.resize(width, width);
00029 vil1_rgb<unsigned char> white(255,255,255);
00030 int h2 = height/2, d = 10;
00031 for (unsigned int x1 = 0; x1<width; x1++)
00032 for (unsigned int x2 = 0; x2<width; x2++)
00033 {
00034 float p0=0.0, p1=0.0, n=0.0;
00035 for (int y = h2-d; y<h2+d; y++, n++)
00036 {
00037 p0 += im0(x1,y);
00038 p1 += im1(x2,y);
00039 }
00040 p0/=n; p1/=n;
00041 vil1_rgb<unsigned char> cp((unsigned char)p0, (unsigned char)p1, 0);
00042
00043 if (x1==x2||x1==x2+150)
00044 im(x1,x2)=white;
00045 else
00046 im(x1,x2)=cp;
00047 }
00048 output_image_ = im;
00049 return true;
00050 }
00051