Created
September 1, 2015 16:50
-
-
Save hG3n/bbb4e45bbd836b2f7f9c to your computer and use it in GitHub Desktop.
two little functions converting either 2d into 1d or 1d into 2d coordinates
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
cv::Point index2Coord(int index) | |
{ | |
int x = index % width; | |
int y = index / width; | |
return cv::Point(x,y); | |
} | |
int coord2Index(int x, int y) | |
{ | |
return x + width*y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment