2017-04-11 16:27:49 -0600 | received badge | ● Notable Question (source) |
2016-07-11 12:59:05 -0600 | received badge | ● Popular Question (source) |
2014-05-08 00:40:11 -0600 | asked a question | processing images Asynchronously from onCameraFrame callback I am getting the Mat image that is provided from onCameraFrame() callback method. this I get from CvCameraViewFrame inputFrame that is passed in the parameters. This use of OpenCV in this example is the Java API version to be used in Android the problem is that the Imgproc.HoughCircles() method for proccessing the image takes time. I want to use a background thread or Android AsyncTask for this. I tries this several time and it is not working. Is there some example that shows how to do this correctly or how can this be done. running HoughCirles method inside onCamraFrame() really does slow down the camera frame rate. It looks like doing this on a separate thread is the best way to go. here is my attempt below. it does not work. it is using AsyncTaksk to run HoughCircles on a background thread. i have tried using a boolean value as shown below to prevent any new frames from being started until the current thread running HoughCircles is finished. the other way i tried is to use a counter variable and only pull one frame out of 10 frames. but this did not work either. he is what I tried as an example: |
2013-12-10 01:38:49 -0600 | asked a question | CameraBridgeViewBase getWidth() and getHeight() null how can i get getWidth() and getHeight() to work for a CameraBridgeViewBase object in OpenCV for Android/Java? it is returning null no matter where i put it it gets null in onCreate for Android Activity method, so i put it in the onCameraViewStarted callback method and same null problem, i even tried the onContentChanged method for activity, any ideas? |
2013-12-09 06:55:05 -0600 | asked a question | how to increase the sensitivity of the HoughCircle method i am using this method, the Java wrapper for the C++ function cvHoughCircles, using this with Android. what are some ways i can make this method more sensitive for positive detection. i am using it to detect circular objects on a plain wooden desk background, so there is not much in that background to cause a false positive, but i have the opposite problem i have some circular objects that it will not pick up and wanted to increase the accuracy. so more positive results would be better. in addition i found that Imgproc.GaussianBlur(mGray, mGray, new Size(5, 5), 2, 2); was decreasing the sensitivity even more than it was before using it so i removed this method. i did see many examples on the internet that used it. a little confused about the 4th parameter in the HoughCircle method shown above, in this case the 1, would that have any effect on how sensitive the method is? from the documentation for the 4th parameter, |
2013-12-09 03:00:58 -0600 | received badge | ● Editor (source) |
2013-12-09 02:58:49 -0600 | asked a question | vary slow frame rate when calling HoughCircles() method from onCameraFrame, Android/Java extremely slow frame rates when using the openCV Java method in android for detecting circular shaped objects in images Imgproc.HoughCircles(mGray, circles, Imgproc.CV_HOUGH_GRADIENT, 1, 50); when i remove this method it runs fast, but after adding this method inside of this callback public Mat onCameraFrame(final CvCameraViewFrame inputFrame) { the frame rate slows to 1 to 2 frames per second, I don't understand why it gets so slow, i tried putting this method in a separate thread and it would not help, the only thing that worked is to use a counter and and an if statement to run the method every 10 frames. in the OpenCV examples there is a sample project called face detection and it has both a native C++ and Java camera versions and they both are vary fast, how is it possible that when I use similar code I get this slow constipated action from OpenCV? is there something i am doing wrong here? In the face detection project from openCV examples they take every frame and they don't launch a separate thread. how do I fix this problem and make my code run fast like the sample projects in OpenCV? in a different project I am also having the same problem of slow frame rate, in this practice project where I am not using openCV, it is just the android Camera class only, in that I am taking the image from the onPreviewFrame(byte[] data, Camera camera) method and doing some light processing like converting the YUV format from the byte array into a bitmap and putting that into another view on the same screen as the camera view, and the result is vary slow frame rate. EDIT: In some additional experimentation i added the Imgproc.HoughCircles() method to the OpenCV face Detection sample project. putting this method inside the onCameraFrame method of the java detector. the result is the same as in my project, it became vary slow. so the HoughCircles method probably takes more processing power than the face detection method CascadeClassifier.detectMultiScale(), however that does not explain the fact I watched other circle detection projects on youTube and in their videos the frame rate is not slowed down. that is why I think something is wrong with my code. here is a sample of the code I am using (more) |