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