In order to simplify marking the positive images, instead of marking and identifying thousands of images we decided to try marking one image and rotating the image 1 degree for a complete 360 degree rotation. We are hoping that this will still bring about enough variance in our data sets, while still increasing the hit rate without the initial overhead and pain of individually marking all images.

Right-Handed Cartesian System

For image processing we are dealing with a left-handed coordinate system as opposed to the usual right-handed Cartesian coordinate system (typically seen in mathematics) that we usually deal with. For example, the right handed has center point (0,0) set in the middle of the graph with positive x moving right along the axis, while positive y moves up the axis.
The angle of rotation is as a counter-clockwise rotation. With this system there are negative coordinates available for plotting, where as negative values do not make sense in the context of computer graphics for positions of pixels.
 

Left-Handed Cartesian System


So for the left-handed Cartesian coordinate system as dealt with in computer graphics; begins with the point (0,0) in the upper left corner and positive x moving right along the axis, while positive y moves down the axis. The angle of rotation is as a clockwise rotation. So the rotation matrix would reflect the rotation difference by a -Θ(-angle) since the direction of vector rotation is counterclockwise if Θ is positive (e.g. 45°), and clockwise if Θ is negative (e.g. -45°).
 
 

Rotation Matrix for Clockwise Rotation

Apply the rotation matrix to the following matrix multiplication table which will rotate the column vectors of the image. So the coordinates (x’,y’) of the point (x,y) after rotation are derived from the following formula.
 
 


 
 
 
Below is a code excerpt for getting the new new point after rotation.

//Get the distance from the center to our point of interest                     
int a = x - src_center.x;
int b = y - src_center.y;
double distance = sqrt((double)((a*a) + (b*b)));

//Convert the angle to radians
double radians = angle * (PI/180);

float deltaX = cos(radians) * a + sin(radians) * b;
float deltaY = cos(radians) * b - sin(radians) * a;

//Add the delta (change) values to our initial point value to get the shift and new coordinates
float newXPos = src_center.x + deltaX;
float newYPos = src_center.y + deltaY;

Tags: ,

Leave a Reply