Ask Your Question

Pulkit's profile - activity

2020-11-13 08:21:21 -0500 received badge  Notable Question (source)
2019-07-10 12:20:15 -0500 received badge  Popular Question (source)
2018-02-24 23:31:25 -0500 received badge  Famous Question (source)
2017-08-09 15:23:27 -0500 received badge  Notable Question (source)
2017-06-19 06:03:50 -0500 received badge  Popular Question (source)
2016-12-26 23:30:47 -0500 commented answer Convert Mat to byte[] in C++

what is bytes here ?? and ther is no byte data type in c++ ????

2016-12-26 23:21:04 -0500 asked a question how to convert Mat to jbyteArray ??

I have to return a jbyteArray (I'm using JNI and want a byte[] to return to the Java part). I have a native function in java with return type byte[].

I have an image in Mat and i have to convert it into jbyteArray so as to return it to my java code, and I don't know what it's the best approach.

2016-10-05 00:23:46 -0500 commented question How to obtain probability estimates from RTrees classifier in OpenCV 3.x?

Hi, Did you find any way to get the probability values of random forest classifier ???

2016-08-09 00:47:20 -0500 commented question Android Studio: OpenCV + NDK

Hey i am also having the same problem. If you have any good tutorial on this. please share the link , Thank You !!

2016-08-09 00:29:12 -0500 asked a question Trouble setting up OpenCV with NDK in Android Studio

Hi, I would like to use OpenCV with the NDK in my Android Project. I am using Android Studio. I can't get it to compile properly. I am getting error while including opencv2 in my cpp file..... **

I followed all the steps. i copied all the native libs to my jniLibs


My gradle looks like this



LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)




include F:/PULKIT/Resources/Android OpenCV/OpenCV-2.4.11-android-sdk/OpenCV-android-sdk/sdk/native/jni/


LOCAL_C_INCLUDES += F:/PULKIT/Resources/Android OpenCV/OpenCV-2.4.11-android-sdk/OpenCV-android-sdk/sdk/native/jni/include

LOCAL_LDLIBS +=  -llog -ldl


This is my file

APP_STL := gnustl_static

APP_CPPFLAGS := -frtti -fexceptions

APP_ABI := armeabi-v7a

APP_PLATFORM := android-17

ERROR i am getting is


2016-05-18 01:39:48 -0500 asked a question cascade classifier takes hours in testing one image

I am trying to train a cascade classifier with matlab and c++. I am trying to detect optic disc in retinal fundus images. number for positive samples i have used are around 12000(after flipping) and negative samples are 10000. Max hit rate is 0.995 and false alarm rate is 0.1. I trained a classifier using matlab for 40 stages using haar and one with hog features. Testin for one image takes hours and returns very bad results. if anyone can tell me what i am doing wrong it would be very help full. Even if i reduce the number of stages to 20 it still takes hours to test.

PS:- Dimensions of positive and negative images is roughy around 800x1200. C++ classifier is not yet trained.Its been 15 days. May be i will get results from c++ when hell freezes over.


2016-03-21 05:32:58 -0500 asked a question how to use opencv in android studio in native c++ code ??

how can i use openCV in an android studio's project - but i need to use it in other native cpp files and not in java.

all the guides and tutorials i found explain how to use openCV in java files (loadLibrary..)

eventually i have all the .so in jniLibs folder or add openCV as a module with a dependency. I am using Android Studio 1.4.1 and opencv 2.4.11.

2016-03-09 03:41:05 -0500 asked a question Need to find GLCM matrix

I am using OpenCV 2.4 in android (Android Studio). I want to find GLCM matrix of an image . Is there any class/function for the same ?

2016-03-04 01:50:44 -0500 received badge  Enthusiast
2016-03-03 06:58:28 -0500 received badge  Editor (source)
2016-03-03 06:56:36 -0500 answered a question how to detect and measure foot length and width in image ?

I am assuming you mean length of rectangle when you say height.

I think the best way to detect foot is by edge detection. You should try some morphological operations and then you can use some edge detection techniques (canny, sobel operator, gradient etc). If all the images are gonna be like the one you posted then the strongest edge or the biggest component(if you apply some global thresholding) will be your leg. I think to remove some false positives you can do some texture analysis (texture of the foot and background are totally different), histogram analysis (to get the color difference) and generate a classifier. After your component has been classified you can get the rectangle surrounding the foot easily. Just find the min x, min y, max x, max y values. So your height will be (max y - min y) and width will be (max x - min x) or just use the inbuilt function of opencv.

If you want the actual height of the leg then you will have to c alculate the disparity and depth map of the image.

2016-03-03 06:45:27 -0500 commented question Matlab haar cascade opencv android compatibility

Thanks for reply. I tried it it doesnt work actually. My xml file was compatible with 2.4 but i tried loading it in 3.0. It was loading the xml file. When i changed my version back to 2.4, everything worked as it should.

2016-03-03 01:55:16 -0500 answered a question printed circuit board component image recognition

You will have to use classification approach towards the object detection in PCB.Either you can use Haar Cascade but i believe here is gonna be too much false positive in haar cascade detection. Another option is you will have to use some image processing techniques(do a little literature survey) and after use some state of the art classifiers like random forest or svm or any other.In my opinion template matching might not be very robust. :)

2016-03-03 01:49:26 -0500 received badge  Critic (source)
2016-03-03 01:44:34 -0500 asked a question Matlab haar cascade opencv android compatibility

I trained a haar cascade classifier in matlab. I want to use the model(xml file) in opencv with android. The xml file says its compatible with OpenCV 2.4. I am using OpenCV 3.0 in android. Will it have any compatibility issue? I am using Android Studio.

2016-03-01 05:04:58 -0500 commented question how to get Hue chnanel using open cv in android

i am getting error while using merge function ...

I want to merge V channel with the matrix .


the error i am getting is

OpenCV Error: Assertion failed (checkScalar(value, type(), _value.kind(), _InputArray::MAT )) in cv::Mat& cv::Mat::setTo(cv::InputArray, cv::InputArray), file /builds/master_pack-android/opencv/modules/core/src/copy.cpp, line 472

com.example.welcome.opencvtest E/org.opencv.core.Mat: Mat::n_1setTo__JJ() caught cv::Exception: /builds/master_pack-android/opencv/modules/core/src/copy.cpp:472: error: (-215) checkScalar(value, type(), _value.kind(), _InputArray::MAT ) in function cv::Mat& cv::Mat::setTo(cv::InputArray, cv::InputArray)

2016-03-01 02:45:48 -0500 commented question how to get Hue chnanel using open cv in android

how to merge your modified h channel back into the hsv (3chan) image ??????????

2016-02-24 23:27:04 -0500 received badge  Supporter (source)
2016-02-24 23:26:44 -0500 commented answer I want to multiply a matrix with a number !

It Worked for me . Thanks for the answer @berak Cheers !!

2016-02-24 23:07:53 -0500 received badge  Scholar (source)
2016-02-24 04:52:19 -0500 received badge  Student (source)
2016-02-24 01:50:11 -0500 asked a question I want to multiply a matrix with a number !

I am using opencv in android studio.

i want:

Mat A;

Mat B;

int num= 255;

B = A*255;

But it is not working.