2013년 12월 19일 목요일

PCA in PCL


/////////////////////////////////////////////////////////////////////////////////////////
template bool
pcl::PCA::initCompute ()
{
  if(!Base::initCompute ())
  {
    PCL_THROW_EXCEPTION (InitFailedException, "[pcl::PCA::initCompute] failed");
    return (false);
  }
  if(indices_->size () < 3)
  {
    PCL_THROW_EXCEPTION (InitFailedException, "[pcl::PCA::initCompute] number of points < 3");
    return (false);
  }

  // Compute mean
  mean_ = Eigen::Vector4f::Zero ();
  compute3DCentroid (*input_, *indices_, mean_);
  // Compute demeanished cloud
  Eigen::MatrixXf cloud_demean;
  demeanPointCloud (*input_, *indices_, mean_, cloud_demean);
  assert (cloud_demean.cols () == int (indices_->size ()));
  // Compute the product cloud_demean * cloud_demean^T
  Eigen::Matrix3f alpha = cloud_demean.topRows<3> () * cloud_demean.topRows<3> ().transpose ();

  // Compute eigen vectors and values
  Eigen::SelfAdjointEigenSolver evd (alpha);
  // Organize eigenvectors and eigenvalues in ascendent order
  for (int i = 0; i < 3; ++i)
  {
    eigenvalues_[i] = evd.eigenvalues () [2-i];
    eigenvectors_.col (i) = evd.eigenvectors ().col (2-i);
  }
  // If not basis only then compute the coefficients

  if (!basis_only_)
    coefficients_ = eigenvectors_.transpose() * cloud_demean.topRows<3> ();
  compute_done_ = true;
  return (true);
}



from /opt/ros/fuerte/include/pcl-1.5/pcl/common/impl/pca.hpp


2013년 12월 16일 월요일

생각대로



저렇게 긍정적으로 생각해야겠지? 

2013년 12월 12일 목요일

Z-Y-X Euler Angles

Z-Y-X Euler Angles
Z-Y-X Euler Angles (or X-Y-Z fixed angles)
Rx'y'z' (a,b,c) =

[ cos(a)*cos(b), cos(a)*sin(b)*sin(c) - cos(c)*sin(a), sin(a)*sin(c) + cos(a)*cos(c)*sin(b)]
[ cos(b)*sin(a), cos(a)*cos(c) + sin(a)*sin(b)*sin(c), cos(c)*sin(a)*sin(b) - cos(a)*sin(c)]
[       -sin(b),                        cos(b)*sin(c),                        cos(b)*cos(c)]



X-Y-Z Euler Angles
Rz'y'x' (a,b,c) =

[                        cos(b)*cos(c),                       -cos(b)*sin(c),         sin(b)]
[ cos(a)*sin(c) + cos(c)*sin(a)*sin(b), cos(a)*cos(c) - sin(a)*sin(b)*sin(c), -cos(b)*sin(a)]
[ sin(a)*sin(c) - cos(a)*cos(c)*sin(b), cos(c)*sin(a) + cos(a)*sin(b)*sin(c),  cos(a)*cos(b)]



Rz'y'x' (c,b,a) =
[                        cos(a)*cos(b),                       -cos(b)*sin(a),         sin(b)]
[ cos(c)*sin(a) + cos(a)*sin(b)*sin(c), cos(a)*cos(c) - sin(a)*sin(b)*sin(c), -cos(b)*sin(c)]
[ sin(a)*sin(c) - cos(a)*cos(c)*sin(b), cos(a)*sin(c) + cos(c)*sin(a)*sin(b),  cos(b)*cos(c)]




2013년 10월 31일 목요일

Nikola Tesla

“If you want to find the secrets of the universe, think in terms of energy, frequency and vibration.”


― Nikola Tesla

2013년 10월 27일 일요일

ARCBALL




회전축과 회전각도를 결정하여 회전 Quaternion 을 구해냄.
마우스 입력으로 3차원 회전축과 각도를 어떻게 결정하는지 알면 끝.
현재점과 anchor 점을 결정할 때 2D 입력을 spherical mapping을 사용하여 3D Vector로 mapping.

본 논문 : 
ARCBALL: a user interface for specifying three-dimensional orientation using a mouse
http://dl.acm.org/citation.cfm?id=155312

2013년 10월 25일 금요일

예쁜 구름

지난 10월초 유럽의 어느 하늘 위. 

2013년 10월 24일 목요일

#pragma warning(disable : 4244)


#if (_MSC_VER)      
// make microsoft visual studio complain less about double / float conversion.
#pragma warning(disable : 4244)
#endif


ofQuaternion.h 에서 참고


2013년 10월 20일 일요일

Take Screenshot After Some Delay: gnome-screenshot


$ gnome-screenshot -w -d 2

 -d 2 is used for delaying the screenshot for 2 seconds. So within the 2 seconds, we can make the window which we want to take screenshot as active.

2013년 9월 1일 일요일

Lifelines



Lifelines of referenced historical figures

꼭지점 필터

솔리드 웍스 작업중에 자꾸 켜지는 꼭지점 필터.


Curvature

Geometry perception 과 관련하여:
Larger curves explored by touching multiple points, whether statically or dynamically, appear to be judged by the difference in local slope at different points of contact (Pont, 1997; Pont, Kappers, & Koenderink, 1999).
from Lederman, Susan J., and Roberta L. Klatzky. "Haptic perception: A tutorial." Attention, Perception, & Psychophysics 71.7 (2009): 1439-1459.


Pont, S. C. (1997). Haptic curvature comparison. Unpublished doctoral
dissertation, Helmholz Instituut, Utrecht.

Pont, S. C., Kappers, A. M. L., & Koenderink, J. J. (1999). Similar mechanisms underlie curvature comparison by static and dynamic touch. Perception & Psychophysics, 61, 874-894.


2013년 8월 27일 화요일

수요일 알리미

"매번 벌써 수요일인가?" 라는 생각을 하게하는 수요일 알리미. 



myDAQ

좋은 세상이구나~

2013년 8월 26일 월요일

Eigenvalues of rotation matrix : 0~180 degrees

Eigenvalue의 의미를 보여주는 그래프. y축은 imaginary axis.


추가 1)
When an n×n rotation matrix, Q, does not include −1 as an eigenvalue, so that none of the planar rotations of which it is composed are 180° rotations, then Q+I is an invertible matrix. Most rotation matrices fit this description.