Ask Your Question

Jdban's profile - activity

2019-06-04 12:13:07 -0500 received badge  Notable Question (source)
2018-09-03 04:16:57 -0500 received badge  Notable Question (source)
2018-08-17 18:06:54 -0500 received badge  Popular Question (source)
2018-03-24 10:52:34 -0500 received badge  Popular Question (source)
2016-01-23 23:07:54 -0500 received badge  Popular Question (source)
2015-04-12 21:47:59 -0500 received badge  Enthusiast
2015-04-09 12:10:44 -0500 commented answer Is HSV supposed to look extremely blotchy in opencv?

Thanks! So basically, its blotchy because in the mostly grayimage there isnt much variance, and when there IS variance, its a big variance in weird blotches.

I ran a couple more images through my HSV and they look less blotchy. Images with more color:

2015-04-08 23:13:16 -0500 commented answer Is HSV supposed to look extremely blotchy in opencv?

Yes, I am using imread. So I changed it to use BGR2HSV instead of RGB2HSV as you suggested.

Now it looks like this (BGR to HSV):

Instead of this (RGB TO HSV):

It looks better, but still blocky. Is that expected?

2015-04-08 10:37:56 -0500 asked a question Is HSV supposed to look extremely blotchy in opencv?

Here is my input followed by its hsv converted output. If you look at the full size image, you can see that my hsv image is blocky and weird looking.

image description

Here is the hue channel alone, you can see how poorly blocky it is here as well: image description

Is the blotchiness supposed to happen?

This is essentially all I'm doing in code:

Mat hsvImg;
cvtColor(srcImg, hsvImg, CV_RGB2HSV);
Mat channels[3];
split(hsvImg, channels);
imshow("Original", srcImg);
imshow("HSVImg", hsvImg);

When I google to see HSV images, I see stuff like this: image description

All the sample images I see don't look as insanely blocky as mine do. Am I doing something wrong?

2015-03-01 02:41:45 -0500 asked a question Is anyone using CLion IDE? Are there any guides for CLion with Opencv?

Is anyone using CLion IDE? Are there any guides for CLion with Opencv?

I'm currently developing in windows using C++. Are there any CLion guides?

2013-01-19 17:46:31 -0500 asked a question Is there a way to grab all the pixels of a matrix in Java, operate on every pixel, and then put them all back into the image, using only two JNI calls?

I'm trying to do an operation on every pixel (brightness and contrast) and am wondering if I'm missing something. Is there no way to do it smartly in the java?

I'd love my code to look like this:

byte[imagesize*pixels] imagepixels = mRgba.toPixels();

for(int k = 0; k < imagepixels.size; k++
   imagepixels[k] = imagepixels[k]*alpha + beta


But instead it looks like this:

    for( int y = 0;  y < mRgba.rows(); y++)
        for(int x = 0; x < mRgba.cols(); x++)

                dbl = mRgba.get(y, x);
                pix[0] = roundProperly(contrast*(dbl[0]) + brightness);
                pix[1] = roundProperly(contrast*(dbl[1]) + brightness);
                pix[2] = roundProperly(contrast*(dbl[2]) + brightness);
                pix[3] = 0;
                mRgba.put(y, x, pix);
                dbl = null;

There are tons of memory issues because dbl is being malloced extremely frequently and making the garbage collector block, and I'm doing WAY more JNI calls than I'd like.

I plan on porting this into a single C call, but I'm curious to see the straight java performance of this vs the C performance, and I'd prefer there to be a way to do the java this inefficiently.

2013-01-15 05:50:47 -0500 asked a question Wanting to adjust brightness/contrast of an image, similar to

I have an image of a crosswalk, and its very hard to do processing on it to detect the crosswalk. I was playing in and stumbled upon changing the contrast/brightness, I was able to EASILY distinguish the crosswalk so that I could threshold with HSV values. Btw I am running this on my android phone.

Here is my before image: image description

And here is my after image from after adjusting brightness: image description

In other images where its even more poorly colored, this does a great job too.

I was wondering how I could replicate this effect in OpenCV, what options are there?

2013-01-12 14:46:53 -0500 received badge  Scholar (source)
2013-01-12 14:46:47 -0500 commented answer Is there any way to view the native C/C++ code for Opencv for Android?

Yes, that's exactly what I meant, thank you!

2013-01-12 04:21:20 -0500 received badge  Student (source)
2013-01-11 18:23:44 -0500 asked a question Is there any way to view the native C/C++ code for Opencv for Android?

I'd love to see the C code and how its optimized, but it seems to be bundled inside the OpenCV Manager app and not available inside the source that I can find on SourceForge or in the Git repository. I can find the names of the function calls that call into the native code, but I can't find the actual native code anywhere. Is this code available? If so, where can I find it?

2012-11-25 03:55:46 -0500 commented answer Build Errors after OpenCV Library Import

It took me FOREVER to find out how to fix this... I wish when I downloaded the SDK today it didn't have the .settings folder.

2012-11-14 16:58:13 -0500 asked a question Having weird issues drawing lines on android

When I draw lines on android, I'm getting weird graphical glitches like so: image description

these lines are being drawn to the image pretty simply:

Core.line(mRgba, pt1, pt2, new Scalar(0, 255, 0), 3);

Does anyone know why its not doing what it should be doing and just putting that entire line as green?

2012-11-01 03:10:58 -0500 received badge  Supporter (source)
2012-11-01 00:24:05 -0500 received badge  Editor (source)
2012-11-01 00:10:52 -0500 asked a question Trying to calculate histogram on Android and find the median. Unsure how to access histogram data from Mat

I'm trying to find the median, which I believe can be done by using the code given here:

What I have so far in java is the histogram calculation working fine (I assume), and at that point, I don't know what to put insude my calcMedianOfHist function. The issue I'm running into is that I don't know how to access the bins of the histogram. The closest I've come to finding out how to do this is looking at this example for C code, but that doesn't apply to the Java. (

The method there says to do<float>(num), but I cannot do that in java.

I'm also not 100% sure if I should be normalizing the hist like this or not.

Any help is appreciated, thank you.

        ArrayList<Mat> list = new ArrayList<Mat>();

        MatOfInt one = new MatOfInt(0);
        int median = 0;

        hist = new Mat();

        MatOfInt histSize = new MatOfInt(25);
        MatOfFloat range = new MatOfFloat(0f, 256f);

        Imgproc.calcHist(Arrays.asList(mGraySubmat), one, new Mat(), hist, histSize, range);

        Core.normalize(hist, hist);

        median = calcMedianOfHist(hist, mGraySubmat.cols(), mGraySubmat.rows());

        System.out.println("Median is: " + median);
2012-11-01 00:04:28 -0500 received badge  Critic (source)