Last active
November 15, 2015 02:48
-
-
Save nmattam/4a1a5266741a18571d59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@params | |
$center_x: returned by Coyote (is the percentage of photo width) | |
$center_y: returned by Coyote (is the percentage of photo height) | |
$thresh: threshold value for matching (currently set to 0.030) | |
$pwidth: width of the photo | |
$pheight: height of the photo | |
*/ | |
function compare_cordinates($image_name,$tids,$center_x,$center_y,$thresh,$pwidth,$pheight){ | |
/* Find new coordinates in the x-axis ($x_lower and $x_upper) which is at the threshold pixels to the right and left of the $center_x. | |
*/ | |
$x_lower=($center_x*$pwidth/100)-($pwidth*$thresh); | |
$x_upper=($center_x*$pwidth/100)+($pwidth*$thresh); | |
/* Find new coordinates in the y-axis ($y_lower and $y_upper) which is at the threshold pixels at the top and bottom of the $center_y. | |
*/ | |
$y_lower=($pheight-($center_y*$pheight/100))-($pheight*$thresh); | |
$y_upper=($pheight-($center_y*$pheight/100))+($pheight*$thresh); | |
// uid_x and uid_y are the coordinates from the iOS app stored in the DB. | |
/* Update the user tid in the database (match the coordinates from Coyote and iOS app) if the uid_x and uid_y falls in between the calculated threshold coordinates.*/ | |
$iQuery = "update train_user_app set tid='".$tids."' where image_name='".$image_name."' and uid_x between '".$x_lower."' and '".$x_upper."' and uid_y between '".$y_lower."' and '".$y_upper."'"; | |
$iResult = mysql_query( $iQuery); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment