Ask Your Question

Joseph Howse's profile - activity

2017-07-11 10:58:58 -0500 received badge  Nice Answer (source)
2017-02-01 23:54:06 -0500 answered a question OpenCV manager for the 3.2.0 library

Although the Google Play Store version of OpenCV Manager hasn't been updated since OpenCV 3.0.0, I see new builds in the apk folder of the OpenCV Android 3.2.0 release (from Choose the APK that matches your Android device's architecture, and sideload it using ADB. For example, if you are using an armeabi-v7a device, run this in the command prompt:

adb install OpenCV_3.2.0_Manager_3.20_armeabi-v7a.apk

[Edit 1] Of course, if you're concerned about easily distributing your app to other people, you shouldn't depend on a version of OpenCV Manager that has to be sideloaded. However, if your app is just for your use or internal organizational use, this might be fine.

[Edit 2] I've opened an issue at to request that the latest builds be published to Google Play Store.

2017-02-01 23:12:05 -0500 commented answer OpenCV manager for the 3.2.0 library

To maximize compatibility, yes, copy all of the libs subfolders. Thus, your project's libs folder will have subfolders arm64-v8a, armeabi, armeabi-v7a, mips, mips64, x86, and x86_64.

2016-12-20 10:53:04 -0500 commented answer Confidence value for svm model

Thanks, you are correct. Also, it's worth noting that the distance is only returned in the case of 2-class classification, and only when the SVM type is C_SVC or NU_SVC. (This limitation is the same in 2.4 and 3.x.) Otherwise, just the classification is returned.

2016-12-20 10:52:34 -0500 received badge  Supporter (source)
2016-12-20 06:49:33 -0500 commented answer Confidence value for svm model

Does this work in OpenCV 3.x? The StatModel docs suggest that the signature of predict() has changed, and I can't find whether it's still possible to get the confidence for SVM.

2016-05-15 13:24:08 -0500 received badge  Editor (source)
2016-05-15 07:38:22 -0500 answered a question Show number of blob detection


Your question still isn't clear. Do you still have some doubts about how to do blob detection, or are you just asking how to draw text?

You can use the putText function (in the imgproc module) to draw text on the image. You may also want to use the getTextSize function to help you decide how to position the text. See the documentation of drawing functions:

This seems similar to your other recent question ( Again, please post your code with details of what is or isn't working. Generally, people will not answer your posts unless you show your work, and describe the specific errors or unexpected output that you've encountered.

This section of the documentation contains some articles that may help you:

A general approach to blob detection might involve the following steps:

  1. Create a mask, for example using inRange to select relevant colors.
  2. Find edges in the mask, for example using Canny.
  3. Find contours based on the edges, for example using findContours.
  4. Optionally, find a bounding shape for the contours, for example using boundingRect or boundingEllipse.
  5. Optionally, reject some blobs that are too small, the wrong shape, etc.
2016-05-13 08:48:45 -0500 answered a question Android Watershed

So that others can help you, please post code with details of what is or isn't working.

I guess that you have produced a thresholded image (using watershed or another technique) and you want to count the blobs in the thresholded image. Try the Imgproc.findContours function, and get the count of contours based on the output of this function. You may need to do some further analysis of the contours to reject ones that are very small, etc. You can find some basic examples of findContours usage in other posts, such as this:

2015-10-09 16:25:58 -0500 received badge  Teacher (source)
2015-10-08 15:39:28 -0500 commented answer Can't use ps3 eye with OpenCV

Hmm ... Are you using the pre-built versions of OpenCV 2.4.11 and 3.0.0, or are you building from source? If you are building from source, could you confirm that the WITH_DSHOW CMake option is enabled?

I see here that the CL-Eye Driver is supposed to provide "Microsoft DirectShow™ Support". This does offer some hope that it should work with the DirectShow back-end of cv::VideoCapture, if WITH_DSHOW was enabled during the build. If an old build of OpenCV was working with this driver, and your new build is not, maybe either (a) WITH_DSHOW was not enabled in the new build, or (b) the newer version of OpenCV has introduced some bug in cv::Capture's DirectShow support.

2015-10-08 14:35:46 -0500 answered a question Can't use ps3 eye with OpenCV

On Linux, cv::VideoCapture can use the PS3 Eye via the standard Video4Linux drivers.

On Windows and Mac, cv::VideoCapture cannot use the PS3 Eye. You will need to capture frames from the Eye using some other camera SDK, such as:

  • PS3EYEDriver - This works with Windows and Mac. It is free but probably subject to GPL because it contains some code copied from the Linux kernel.
  • CL-Eye Platform SDK (not just CL-Eye Driver) - This just works with Windows. It is commercial.

Once you capture a frame using whichever camera SDK, you can create a cv::Mat from the captured data, as illustrated in the following partial code sample:

int width = 320, height = 240;
int matType = CV_8UC3; // 8 bpp per channel, 3 channels
void *pData;

// Use the camera SDK to capture image data.

// Create the matrix. No data are copied; the pointer is copied.
cv::Mat mat(height, width, matType, pData);
2015-10-02 11:10:45 -0500 answered a question traincascade parameters: precalcValBufSize and precalcIdxBufSize

As described in the official documentation, these parameters are buffer sizes, in Mb. An inspection of the source code shows that the default values are 1024 and 1024. My colleague, Steven Puttemans, recommends setting both parameters to 2048, or even 4096, if you have enough memory available. In other words, traincascade should be able to take advantage of really large buffers.

I do not know how performance is affected by setting one buffer size larger than the other. If you end up running tests, please report your results.

2013-07-22 10:46:22 -0500 commented question Android: Exception in cvConvertScale, called from solvePnP

Nevermind, I solved the issue. I had a bug where I was resizing cameraMatrix improperly. As described above, though, 3x3 is the correct size.

2013-07-17 21:17:23 -0500 asked a question Android: Exception in cvConvertScale, called from solvePnP

In an OpenCV4Android app, I get the following error when running Calib3d.solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec):

CvException [org.opencv.core.CvException: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/convert.cpp:1352: error: (-215) src.size == dst.size && src.channels() == dst.channels() in function void cvConvertScale(void const*, void*, double, double)
at org.opencv.calib3d.Calib3d.solvePnP_1(Native Method)
at org.opencv.calib3d.Calib3d.solvePnP(

Can anyone tell me, how does solvePnP use cvConvertScale, and which arguments to solvePnP are likely to cause this exception?

My objectPoints and imagePoints matrices are Nx1 (the same size as each other). My cameraMatrix is 3x3. My distCoeffs is 4x1 and contains all zeroes. My rvec and tvec are newly instantiated MatOfFloat objects.

If any more information would be helpful, please let me know. Thanks!