Ask Your Question
0

Quickest way to convert a vec3b to vec3d

asked 2015-01-11 23:30:47 -0600

sup gravatar image

updated 2015-01-11 23:31:27 -0600

I want to access a pixel, which is in uchar format, in double format, for some floating point operations. I am forced to use at<vec3b> since .at<vec3d> will access wrong elements. Is there a way to quickly convert it to vec3d or should I do it manually ?

Also, I thought about using at<mat> but it crashes without informations. Is this behavior normal, i.e Mat not supported ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-07-15 16:02:11 -0600

TienHa gravatar image

I had the same problem and found out that it's pretty easy to use: im.convertTo(convertedIm, CV_64F, scale) // scale here is optional, default value is 1.0 After that you can access element of convertedIm by convertedIm.at<vec3d>(i, j)

Hope this helps.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-01-11 23:30:47 -0600

Seen: 1,847 times

Last updated: Jan 11 '15