Ejemplo n.º 1
0
void	draw_up(t_bunny_pixelarray *content,
		float *vec, t_color *color)
{
  int	i;
  int	j;

  j = vec[1] - 1;
  while ((j = j + 1) <= vec[6] && j < vec[3])
    if ((i = ((float) j - vec[1]) / vec[4] + vec[0]) <= vec[5])
      if (get_pixel(content, i, vec[6] - j))
	mean_color(get_pixel(content, i, vec[6] - j), *color, 0.9);
}
Ejemplo n.º 2
0
void	draw_down(t_bunny_pixelarray *content,
		  float *vec, t_color *color)
{
  int	i;
  int	j;

  i = vec[0] - 1;
  while ((i = i + 1) <= vec[5] && i < vec[2])
    if ((j = (((float) i - vec[0]) * vec[4] + vec[1])) <= vec[6])
      if (get_pixel(content, i, vec[6] - j))
	mean_color(get_pixel(content, i, vec[6] - j), *color, 0.9);
}
Ejemplo n.º 3
0
	void compute( Ref<RMatrixXf> r, const ImageOverSegmentation & ios ) const {
		Image f_im;
		if( lab_ )
			rgb2lab( f_im, ios.image() );
		else
			f_im = ios.image();
		
		const int N = ios.Ns();
		std::vector<Vector3f> mean_color( N, Vector3f::Zero() );
		std::vector<float> cnt( N, 1e-8 );
		const RMatrixXs & s = ios.s();
		for( int j=0; j<s.rows(); j++ )
			for( int i=0; i<s.cols(); i++ ) 
				if( s(j,i) >= 0 ){
					mean_color[ s(j,i) ] += f_im.at<3>( j, i );
					cnt[ s(j,i) ] += 1;
				}
		for( int i=0; i<N; i++ )
			mean_color[i] /= cnt[i];
		
		for( int i=0; i<(int)ios.edges().size(); i++ )
			r.row(i) = (mean_color[ ios.edges()[i].a ]-mean_color[ ios.edges()[i].b ]).array().abs();
	}