First time here? Check out the FAQ!

Ask Your Question
1

mat::push_back

asked Apr 2 '13

wsc36305 gravatar image

updated Oct 21 '15

Here i have some trouble with the method of Mat,which is Mat::push_back() I have two groups of float numbers,and i want to push_back them into a CV_32FC2 Mat. But i don't known how to push_back two float numbers into the CV_32FC2 Mat,and I want to get the data with Mat img.at(i,j)[0] and Mat img.at(i,j)[1],Could anybody help me?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
4

answered Apr 2 '13

Daniil Osokin gravatar image

Hi! You can do it with Vec2f:


Vec2f pair = Vec2f(firstFloat, secondFloat);

// dst is a CV_32FC Mat
dst.push_back(pair);

For access use:

dst.at<Vec2f>(rowId)[0]
Also, check this answer "Working with pixels".

Preview: (hide)

Question Tools

Stats

Asked: Apr 2 '13

Seen: 2,632 times

Last updated: Apr 02 '13