Ask Your Question

kronos_r's profile - activity

2014-08-25 04:11:20 -0600 asked a question Apply blindness filter lags

I come at you to know how to apply a simple colored filter in a camera preview with OpenCV Android.

I want to apply a filter like "Sepia" in "Image manipulaton sample" with the kernel. I found my XYZ filter, here the blindness kernel.

// Fill TRINATOPIA kernel
    mTritanopia = new Mat(4, 4, CvType.CV_32F);
    mTritanopia.put(0, 0, /* R */0.95, 0.05, 0, 0);
    mTritanopia.put(1, 0, /* G */0, 0.43333, 0.56667, 0);
    mTritanopia.put(2, 0, /* B */0, 0.475, 0.525,0);
    mTritanopia.put(3, 0, /* A */0.000f, 0.000f, 0.000f, 0f);

Next to this step, I use transform(), the same thing found in the sample.

        Core.transform(rgba, rgba, mTritanopia);

The result LAGS a bit ! There is an other way to success ?

2014-08-21 08:50:49 -0600 commented question InRange result merged with RGBA frame

That's what I thought, but I have blackscreen with an error. See my new code on edited post.

2014-08-21 08:10:53 -0600 received badge  Supporter (source)
2014-08-21 04:24:59 -0600 commented question InRange result merged with RGBA frame

I mean, I would like at least change white displayed object to another color from the inrange result. like yellow on black background at least But with a merge both of mask are not in the same cvtype :/ how ?

2014-08-20 09:12:07 -0600 commented question InRange result merged with RGBA frame

Yes it could help but with Android methods are totally different. I'm a beginner on it

2014-08-20 07:06:28 -0600 received badge  Critic (source)
2014-08-20 06:30:23 -0600 received badge  Editor (source)
2014-08-20 06:28:21 -0600 asked a question InRange result merged with RGBA frame

Hello guys ! I'm using OpenCV4Android for camera preview and in my project I have to Flash colored object. For an example, every yellow object is flashing every 3 secondes. What's the best approach to do it ? Mine, is to get 2 maks, one in RGBA frame and the other mask with only the detected object with a "static hard yellow" and a transparent background. is it possible ?

I already did the yellow detecting with a range but the result is black and white. Then I'm blocked, I suppose that I have to put black in transparent and change white object into yellow for example. To finish, I suppose that too I have to merge both of them.

Here my little code for detection :

Imgproc.cvtColor(rgba, rgba, Imgproc.COLOR_RGB2HSV);
Core.inRange(rgba,  new Scalar(5,50,50), new Scalar(15,255,255), rgba);

I know it's better to have 2 maks ^^'

how to convert InRange result to RGBA result an d change white pixel to yellow ?

EDIT 1

Imgproc.cvtColor(rgba, rgba, Imgproc.COLOR_RGB2HSV, 0);
        Core.inRange(rgba,  new Scalar(10,100,100), new Scalar(30,255,255), rgba);

        Imgproc.cvtColor(rgba, rgba, Imgproc.COLOR_GRAY2RGBA, 3);
        Mat yellow_mask = new Mat(cols, rows, CvType.CV_8UC3, new Scalar(255,255,0));
        yellow_mask.copyTo(rgba);