Ask Your Question
0

Is it safe converting to a Mat itself with different type?

asked 2016-04-24 02:04:01 -0600

Qiang Guo gravatar image

updated 2016-04-24 02:04:28 -0600

The following code can be compiled without error. However, is it safe doing this?

Mat im = imread('test.jpg', CV_LOAD_IMAGE_GRAYSCALE);
im.convertTo(im, CV_32F1);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-04-24 07:23:18 -0600

LBerger gravatar image

Yes I think so. You can check source code of convertTo and there is this line

edit flag offensive delete link more

Comments

1

Well, almost. CV_32F1 isn't a valid constant. It's CV_32F, and convertTo doesn't change the number of channels.

Tetragramm gravatar imageTetragramm ( 2016-04-24 07:46:56 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-04-24 02:04:01 -0600

Seen: 190 times

Last updated: Apr 24 '16