Reputation: 1120
I've got coordinates of one pixel of my image (for example int i,j;
), how can I write them into a vector like the following one?
std::vector<KeyPoint> keypoint_object;
Upvotes: 0
Views: 877
Reputation: 34674
From the documentation, I see there is a constructor for KeyPoint that allows insertion of your indices. However it requires an additional parameter size, and I don't know what you need that to be.
However, the general idea would be this:
keypoint_object.push_back(KeyPoint(i,j,0));
Here, i
and j
are implicitly cast to float
(I assume that is what you require) and the third argument is 0
(as it's mandatory) -- you probably want a more sensible argument here.
Upvotes: 1
Reputation: 97
You can do a class:
class Coordinate{
public:
int x;
int y;
}
...
vector <Coordinate> name;
Coordinate coordinate;
coordinate.x = 1~
coordinate.y = 5~
name.push_back(coordinate);
This is what are you looking for? I hope this will help you!
Upvotes: 2