Пример #1
0
// compute the radon transform
//	it clears out the old radon transform, then iterates through each pixel
//	projecting each one onto each line
void 
Auvsi_Radon::computeRadon()
{
	typedef cv::Vec<float, 1> VT;
	
	clearImage(); // zero out radon because of 
	
	// iterate through each pixel
	for (int i = 0; i < image.size().width; i++)
		for (int j = 0; j < image.size().height; j++)
			// if (sqrt((double)(((float)i - ORIGIN_X)*((float)i - ORIGIN_X) + ((float)j - ORIGIN_Y)*((float)j - ORIGIN_Y)))
						// < (float)IMAGE_WIDTH/2.0 + 1.0)
			// {
			if (image.at<VT>(j, i)[0] > 0.0f)
				computePixel(i, j); // computes one pixel over each lines
			// }
}
Пример #2
0
 void generateRays (
     std::vector<xe::sg::Ray> &rays,
     const xe::Vector2i &size, 
     const xe::Vector3f &cam_pos, 
     const xe::Vector3f &cam_up, 
     const xe::Vector3f &cam_dir, 
     const xe::Vector3f &cam_right) {
     
     assert(size.x > 0);
     assert(size.y > 0);
     assert(rays.size() == size.x*size.y);
 
     const xe::Vector2f sizef = (xe::Vector2f)size;
     const int rayCount = size.x * size.y;
     
     for (int i=0; i<rayCount; i++) {
         xe::Vector2i coord = computePixel(i, size);
         xe::Vector2f coordf = static_cast<xe::Vector2f>(coord);
         xe::sg::Ray ray = castRay(coordf, sizef, cam_pos, cam_up, cam_dir, cam_right);
         
         rays[i] = ray;
     }
 }