Skip to main content

Posts

Showing posts with the label Affine Transform

Affine VS Perspective Transformation using CAMERA

I have used OpenCV's AFFINE and PERSPECTIVE transform to WARP the images. this same process can be done using HARRIS and RANSAC #include <opencv2/video/tracking.hpp> #include <opencv2/highgui/highgui.hpp> #include <stdio.h> #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <opencv2/imgproc/imgproc_c.h> #include <opencv2/video/tracking.hpp> #include <iostream> #include <vector>  void PrintMatrix ( CvMat *Matrix , char * name )  {  printf ("%s\n", name );     for ( int i=0;i<Matrix -> rows ;i++)      {          for ( int j =0;j< Matrix -> cols ;j ++)          {             printf (" %.3f\t",cvGet2D ( Matrix ,i,j).val [0]...

Camera Affine Transformation

An affine transform allows the user to warp, stretch, rotate and resize an image or a footage from a camera. Essentially the image is multiplied by 2x3 matrix to perform the transformation. An affine transform produces parallelograms (which includes standard rectangles). #include <opencv2/video/tracking.hpp> #include <opencv2/highgui/highgui.hpp> #include <stdio.h> #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <opencv2/imgproc/imgproc_c.h> #include <opencv2/video/tracking.hpp> #include <iostream> #include <vector> int angle_switch_value = 0; int angleInt = 0; int scale_switch_value = 0; int scaleInt = 0; void switch_callback_a( int position ){ angleInt = position; } void switch_callback_s( int position ){ scaleInt = position; } int main(int argc, char** argv) { // Set up variab...