Ask Your Question
1

convertTo performance in Android native code

asked 2015-06-04 05:57:46 -0500

sh gravatar image

I working on developing app for android os. I write the code in c++ and use jni.

I have to convert mat from Mat3f to Mat3b in the native c++ code.

I use convertTo :

floatImg.convertTo(ucharImg, CV_8UC3);

ucharImg type is cv::Mat3b, floatImg type is cv::Mat3f.

the issue is the performance of this code in android:

on android this convertTo code takes ~2300 milliseconds! (on window all my function takes ~150 milliseconds)

Is there is a solution to this performance issue?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-06-07 01:04:00 -0500

sh gravatar image

The issue solved. I wrote the conversion in c++ code - loop on floatImg.data an convert each pixel to uchar.

ucharImg.data[i] = (uchar)((float)floatImg.data)[i];

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-06-04 05:57:46 -0500

Seen: 152 times

Last updated: Jun 07 '15