Ask Your Question

lasmi's profile - activity

2020-11-05 14:04:53 -0600 received badge  Popular Question (source)
2017-02-22 00:05:52 -0600 received badge  Notable Question (source)
2015-06-02 14:21:45 -0600 received badge  Popular Question (source)
2013-09-28 09:18:44 -0600 commented question kmeans in java

@berak: java api is an incapsulation of c++ library! my code is in java!

2013-09-26 12:12:23 -0600 received badge  Editor (source)
2013-09-26 11:28:23 -0600 asked a question kmeans in java

Hi! I want to use the function kmeans but I don't understand how I can use that in Java. In c++ the syntax is: double kmeans(InputArray data, int K, InputOutputArray bestLabels, TermCriteria criteria, int attempts, int flags, OutputArray centers=noArray() )

I want to apply this on an image to cluster colors. How can I do in Java! Help me please!

This is my code:

IplImage labels = cvCreateImage(cvSize(1, 1), 8, CV_32F); double [] centers = null; CvArr c = null;

cvKMeans2(src, 2, labels,cvTermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 10, 1.0),1, null,0, c, centers);

src is my image!

I have this error:

OpenCV Error: Assertion failed (labels.isContinuous() && labels.type() == CV_32S && (labels.cols == 1 || labels.rows == 1) && labels.cols + labels.rows - 1 == data.rows)

Why?? What is labels?

2013-08-28 12:05:35 -0600 commented answer threshold yuv image

Thank you for your answer. Now I want to extract a color object from the yuv image (threshold/binary image). So in binary image I want my color object in white and all the other in black. I don't understand how can I do this!

2013-08-27 07:21:44 -0600 asked a question threshold yuv image

Hi! I want to create a binary image from a yuv image. Before I do this with rgb image with this code:

IplImage imgThreshold = cvCreateImage(cvGetSize(img), 8, 1);
cvInRangeS(img, rgba_min, rgba_max, imgThreshold); 
cvSmooth(imgThreshold, imgThreshold, CV_MEDIAN, 15);

How can i create theshold image from yuv image?

Thank you!