Ask Your Question

KristoF124's profile - activity

2016-12-08 22:58:26 -0600 received badge  Popular Question (source)
2016-04-21 01:04:35 -0600 received badge  Famous Question (source)
2015-07-30 16:20:17 -0600 received badge  Notable Question (source)
2015-03-10 05:34:18 -0600 received badge  Popular Question (source)
2013-01-27 14:43:24 -0600 commented answer How can I display timer results with a C++ "putText" command?

I' ve found the mistake in the second line of the code, which you have provided: it should be: sprintf(str, "%f detection time",t). Anyway, thank you very much for your help, now everything works.

2013-01-27 13:36:05 -0600 commented answer How can I display timer results with a C++ "putText" command?

Your code is much better but now I get an error: "cannot convert 'double' to 'char const' for argument '2' to 'int sprintf(char, char const*, ...)' ". I don't know how to fix it. Something must be wrong in my timer.

2013-01-27 06:02:26 -0600 asked a question How can I display timer results with a C++ "putText" command?

I working on several Android OpenCV samples, which use native C++ code to perform operations. I have implemented a timer in the C++ code and I would like to display the results of the timer. I have checked a putText command and it works great but I don' t know how to show the results of the timer with it. Here is the code of native part of the application:

#include <jni.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <vector>

using namespace std;
using namespace cv;

extern "C" {
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3View_FindFeatures(JNIEnv* env, 
jobject, jint width, jint height, jbyteArray yuv, jintArray bgra)  
{
jbyte* _yuv  = env->GetByteArrayElements(yuv, 0);
jint*  _bgra = env->GetIntArrayElements(bgra, 0);

Mat myuv(height + height/2, width, CV_8UC1, (unsigned char *)_yuv);
Mat mbgra(height, width, CV_8UC4, (unsigned char *)_bgra);
Mat mgray(height, width, CV_8UC1, (unsigned char *)_yuv);

//Please make attention about BGRA byte order
//ARGB stored in java as int array becomes BGRA at native level
cvtColor(myuv, mbgra, CV_YUV420sp2BGR, 4);

vector<KeyPoint> v;

OrbFeatureDetector  detector(1);
double t = (double)getTickCount();
detector.detect(mgray, v);
t = ((double)getTickCount() - t)/getTickFrequency();
putText(mbgra, t+ " detection time", Point2f(100,100), FONT_HERSHEY_PLAIN, 2,  Scalar(0,0,255,255), 2);
for( size_t i = 0; i < v.size(); i++ )
    circle(mbgra, Point(v[i].pt.x, v[i].pt.y), 10, Scalar(0,0,255,255));
env->ReleaseIntArrayElements(bgra, _bgra, 0);
env->ReleaseByteArrayElements(yuv, _yuv, 0);
}
}

When I compile everything in Eclipse, I get an error: "invalid operands of types 'double' and 'char const [15]' to binary 'operator+'". What am I doing wrong? Is it possible to display the timer results with a "putText" command? How else can I display the measure results?

@Mostafa Sataki Your code is much better but now I get an error: "cannot convert 'double' to 'char const' for argument '2' to 'int sprintf(char, char const*, ...)' ". I don't know how to fix it. Something must be wrong in my timer. Can you help me with it?

2013-01-22 15:50:25 -0600 commented answer How can I measure performance of OpenCV4Android samples on several devices?

Thank you for your answer. The Java profiler is much better for me now and it gives me enough information, I' m looking for.

2013-01-22 03:30:30 -0600 asked a question How can I measure performance of OpenCV4Android samples on several devices?

I'm looking for a way to measure performance of OpenCV4Android samples on several Android devices. I have an FPS Meter but I'm looking for something else. I don't want to use timers. Are there any other ways to do this?

2013-01-15 22:42:56 -0600 received badge  Student (source)
2013-01-15 16:10:57 -0600 received badge  Editor (source)
2013-01-15 08:58:57 -0600 asked a question Using Toast widget to display results from timer in image-manipulations Android app

I'm modifying the image-manipulations sample application for Android. I'm using System.currentTimeMillis() as a timer to measure performance of the application on several devices. I'm trying to display the results from timer on the screen. I use the following command:

           Toast.makeText(getContext(), "" + elapse + "ms is used
           to process", Toast.LENGTH_LONG).show();

When I try to run the part of the app, where the provided code is, the whole application crashes. The debugger shows me an error in SampleCvViewBase.java file in the first line of code:

            synchronized (this) {
            if (mCamera == null) {
                Log.i(TAG, "mCamera == null");
                break;
            }
            if (!mCamera.grab()) {
                Log.e(TAG, "mCamera.grab() failed");
                break;
            }
            bmp = processFrame(mCamera);

The main difference between original image-manipulations sample and my modification is that my app uses image from the internal memory instead from the onboard camera. How can I fix the error and display the results of the timer on the device screen?

2013-01-15 08:38:53 -0600 received badge  Scholar (source)
2013-01-11 14:44:49 -0600 commented answer Imread in Android OpenCV shows an image with too much blue colour

Thank you for you answer. Now it works but only with few pictures. What sort of images can imread load? Before converting the color space to RGB, the imread function opened more images than now. Does it depend on image size?

2013-01-11 11:17:29 -0600 asked a question Imread in Android OpenCV shows an image with too much blue colour

I'm making a modification of image-manipulations sample. I have created an option to load an image from the internal memory of the device. I use the imread function. It shows me pictures with too much blue colour all the time. Here's the code:

case ImageManipulationsActivity.VIEW_MODE_READIMG:
        mRgba = Highgui.imread("/mnt/sdcard/download/02.jpg");
        break;

For example an object on the image should be red, but appears blue. When I add the flag "CV_LOAD_IMAGE_COLOR", the image appears in grayscale. The same problem appears in OpenCV 2.4.2 and in the 2.4.3.2 version. The image, which I'm loading is in full color. How can I display it properly?

2012-12-30 09:50:55 -0600 commented answer How to use a timer to test performance of android opencv samples on several android devices?

I'm using OpenCV 2.4.2 and I also have an fps meter in the samples. Is the fps-meter in OpenCV 2.4.3.1 different from the fps-meter in OpenCV 2.4.2? My aim is to prepare a table with test results of my modified image-manipulations app working on several devices. Can you tell me something more about Java Core.getTickCount() ? As I said in my question, I'm a beginner developer and some more detailed instructions would be really helpful. Can you show me a sample code, which uses Core.getTickCount() ? Anyway, thanks for your answer, I'm also expecting other helpful answers.

2012-12-29 05:30:39 -0600 asked a question How to use a timer to test performance of android opencv samples on several android devices?

I would like to test performance of android opencv samples on several android devices. I read that timer is a good way to test performance but I really don't know how to implement it and what it could measure. I haven't developed anything on Android before. Are there any other ways of testing performance of the android opencv samples on several devices?