First time here? Check out the FAQ!

Ask Your Question
0

Quickest way to convert a vec3b to vec3d

asked Jan 12 '15

sup gravatar image

updated Jan 12 '15

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 ?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Jul 15 '15

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.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Jan 12 '15

Seen: 1,890 times

Last updated: Jan 11 '15