Ask Your Question
1

mat::push_back

asked 2013-04-01 21:23:07 -0600

wsc36305 gravatar image

updated 2015-10-21 07:33:58 -0600

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2013-04-02 04:47:32 -0600

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".

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-01 21:23:07 -0600

Seen: 2,608 times

Last updated: Apr 02 '13