1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /**
- * @file Conversions.cpp
- * @brief boring conversions
- * @author Erik Rodner
- * @date 02/19/2008
- */
- #include "core/image/ImageT.h"
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- #include <iostream>
- #include <assert.h>
- #include "vislearning/baselib/Conversions.h"
- using namespace OBJREC;
- using namespace std;
- using namespace NICE;
- Conversions::Conversions()
- {
- }
- Conversions::~Conversions()
- {
- }
- vector<double> Conversions::stl_vector ( const NICE::Vector & x )
- {
- vector<double> y;
- for ( size_t i = 0 ; i < x.size(); i++ )
- y.push_back(x[i]);
- return y;
- }
-
- void Conversions::resizeImage ( const NICE::Image & src, NICE::Image & dst, int newWidth, int newHeight )
- {
- int nw = newWidth;
- int nh = newHeight;
-
- if ( nw <= 0 ) {
- assert ( nh > 0.0 );
- nw = nh * src.width() / src.height();
- }
- if ( nh <= 0 ) {
- nh = nw * src.height() / src.width();
- }
- dst.resize(nw, nh);
- NICE::scale ( src, &dst );
- }
- void Conversions::resizeImage ( const NICE::ColorImage & src, NICE::ColorImage & dst, int newWidth, int newHeight )
- {
- int nw = newWidth;
- int nh = newHeight;
-
- if ( nw <= 0 ) {
- assert ( nh > 0.0 );
- nw = nh * src.width() / src.height();
- }
- if ( nh <= 0 ) {
- nh = nw * src.height() / src.width();
- }
-
- dst.resize(nw, nh);
- NICE::scale ( src, &dst );
- }
|