oclMat ImageRenderer2::renderImage() const
{
	float beta = alpha;

	const int imageType = CV_MAKETYPE(CV_32F,
		this->lightfield.getRawImage().channels());
	Mat image(this->lightfield.SPARTIAL_RESOLUTION, imageType);
	Vec2f pinholePosition = Vec2f(this->pinholePosition);
	Vec2f spartialCorrection = Vec2f(this->lightfield.SPARTIAL_RESOLUTION.width,
		this->lightfield.ANGULAR_RESOLUTION.height) * -0.5;
	Vec2f angularCorrection = Vec2f(this->lightfield.ANGULAR_RESOLUTION.width,
		this->lightfield.ANGULAR_RESOLUTION.height) * -0.5;
	Vec2f pixelPosition, angularCoordinates;

	int x, y;
	for (y = 0; y < this->lightfield.SPARTIAL_RESOLUTION.height; y++)
	{
		for (x = 0; x < this->lightfield.SPARTIAL_RESOLUTION.width; x++)
		{
			pixelPosition = Vec2f(x, y) + spartialCorrection;
			angularCoordinates = ((pinholePosition - pixelPosition) / beta) +
				pixelPosition;
			angularCoordinates -= angularCorrection;
			image.at<Vec3f>(Point(x, y)) = this->lightfield.getLuminanceI(x, y,
				round(angularCoordinates[0]), round(angularCoordinates[1]));
		}
	}

	return oclMat(image);
}
Example #2
0
 inline oclMat oclMat::operator()( const Rect &roi ) const
 {
     return oclMat(*this, roi);
 }
Example #3
0
 inline oclMat oclMat::colRange(const Range &r) const
 {
     return oclMat(*this, Range::all(), r);
 }
Example #4
0
 inline oclMat oclMat::operator()( Range rRange, Range cRange ) const
 {
     return oclMat(*this, rRange, cRange);
 }
Example #5
0
 inline oclMat oclMat::rowRange(const Range &r) const
 {
     return oclMat(*this, r, Range::all());
 }
Example #6
0
 inline oclMat oclMat::colRange(int startcol, int endcol) const
 {
     return oclMat(*this, Range::all(), Range(startcol, endcol));
 }
Example #7
0
 inline oclMat oclMat::rowRange(int startrow, int endrow) const
 {
     return oclMat(*this, Range(startrow, endrow), Range::all());
 }
Example #8
0
 inline oclMat oclMat::col(int x) const
 {
     return oclMat(*this, Range::all(), Range(x, x + 1));
 }
Example #9
0
 inline oclMat oclMat::row(int y) const
 {
     return oclMat(*this, Range(y, y + 1), Range::all());
 }
 oclMat oclMat::reshape(int /*new_cn*/, int /*new_rows*/) const
 {
     throw_nogpu();
     return oclMat();
 }
Example #11
0
    void copyTo( oclMat &m ) const;
    //! copies those oclMatrix elements to "m" that are marked with non-zero mask elements.
    //It supports 8UC1 8UC4 32SC1 32SC4 32FC1 32FC4
    void copyTo( oclMat &m, const oclMat &mask ) const;
    //! converts oclMatrix to another datatype with optional scalng. See cvConvertScale.
    //It supports 8UC1 8UC4 32SC1 32SC4 32FC1 32FC4
    void convertTo( oclMat &m, int rtype, double alpha = 1, double beta = 0 ) const;

    void assignTo( oclMat &m, int type = -1 ) const;

    //! sets every oclMatrix element to s
    //It supports 8UC1 8UC4 32SC1 32SC4 32FC1 32FC4
    oclMat &operator = (const Scalar &s);
    //! sets some of the oclMatrix elements to s, according to the mask
    //It supports 8UC1 8UC4 32SC1 32SC4 32FC1 32FC4
    oclMat &setTo(const Scalar &s, const oclMat &mask = oclMat());
    //! creates alternative oclMatrix header for the same data, with different
    // number of channels and/or different number of rows. see cvReshape.
    oclMat reshape(int cn, int rows = 0) const;

    //! allocates new oclMatrix data unless the oclMatrix already has specified size and type.
    // previous data is unreferenced if needed.
    void create(int rows, int cols, int type);
    void create(Size size, int type);
    //! decreases reference counter;
    // deallocate the data when reference counter reaches 0.
    void release();

    //! swaps with other smart pointer
    void swap(oclMat &mat);