Ask Your Question

Jérémy K's profile - activity

2020-10-08 00:30:10 -0500 received badge  Nice Answer (source)
2019-08-12 02:45:34 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

How to generate a 3D image based on ChArUco calibration of two 2D images I'm currently extracting the calibration parame

2019-08-12 02:36:33 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

How to generate a 3D image based on ChArUco calibration of two 2D images I'm currently extracting the calibration parame

2019-08-11 16:07:13 -0500 commented question How to generate a 3D image based on ChArUco calibration of two 2D images

Hi @Eduardo , thanks for your comment! I'm currently looking into the stereoCalibrate stuff. Do you however know if ther

2019-08-11 10:39:54 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate 3D image based on ChArUco calibration I'm currently extracting the calibration parameters of two images that we

2019-08-11 10:38:47 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate 3D image based on ChArUco calibration I'm currently extracting the calibration parameters of two images that we

2019-08-10 14:28:45 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate 3D image based on ChArUco calibration I'm extracting the calibration parameters of two images that were taken i

2019-08-10 14:26:22 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate full 3D image based on ChArUco calibration and SIFT I'm extracting the calibration parameters of two images tha

2019-08-10 14:15:36 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate full 3D image based on ChArUco calibration and SIFT I'm extracting the calibration parameters of two images tha

2019-08-10 13:09:52 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate full 3D image based on ChArUco calibration and SIFT I'm extracting the calibration parameters of two images tha

2019-08-10 12:23:58 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate full 3D image based on ChArUco calibration I'm extracting the calibration parameters of two images that were ta

2019-08-10 12:23:49 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate full 3D image based on ChArUco calibration I'm extracting the calibration parameters of two images that were ta

2019-08-10 12:22:33 -0500 edited question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate full 3D image based on ChArUco calibration I'm extracting the calibration parameters of two images that were ta

2019-08-10 11:52:35 -0500 asked a question How to generate a 3D image based on ChArUco calibration of two 2D images

Generate full 3D image based on ChArUco calibration I'm extracting the calibration parameters of two images that were ta

2019-08-09 16:04:16 -0500 commented question Compare segmentation result to ground truth

Interesection over Union seems to be what I need indeed. I'll take a deeper look into it. Thanks a lot for your help @Ed

2019-08-09 05:17:22 -0500 edited question Compare segmentation result to ground truth

Compare segmentation result to ground truth I have some contours which represent certain objects found with cv2.findCont

2019-08-07 10:25:45 -0500 edited question Compare segmentation result to ground truth

Compare segmentation result to ground truth I have some contours which represent certain objects found with cv2.findCont

2019-08-07 10:23:44 -0500 edited question Compare segmentation result to ground truth

Compare segmentation result to ground truth I have some contours which represent certain objects found with cv2.findCont

2019-08-07 10:08:34 -0500 asked a question Compare segmentation result to ground truth

Compare segmentation result to ground truth I have some contours which represent certain objects found with cv2.findCont

2019-07-21 07:57:33 -0500 received badge  Teacher (source)
2019-07-21 05:35:08 -0500 marked best answer KNearest Java Assertion Error[SOLVED]

I'm still new to OpenCV, but already learned a lot. I am however stuck on the K-NN Algorithm. I'm writing some software to read energy meters and I already succesfully wrote the image processing part. When the processing is finished, I end up with digits like this:

image description

For the K-NN part (training and etc), I used almost all code from this OpenCV question. However, when running the following code (and doing the nescessary training in advance):

Mat one_feature = Imgcodecs.imread("/Users/jeremyk/Desktop/output/digits/digit0.png", 0);
Imgproc.resize(one_feature, one_feature, new Size(20, 20));
Mat res = new Mat();
one_feature.convertTo(one_feature, CvType.CV_32F);
one_feature.reshape(1,1);
float p = knn.findNearest(one_feature, 1, res);

I'm getting this nasty error:

OpenCV Error: Assertion failed (test_samples.type() == 5 && test_samples.cols == samples.cols) in cv::ml::BruteForceImpl::findNearest, file C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\ml\src\knearest.cpp, line 325
Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\ml\src\knearest.cpp:325: error: (-215) test_samples.type() == 5 && test_samples.cols == samples.cols in function cv::ml::BruteForceImpl::findNearest]

I can't seem to find any solution to this.. Anyone got a clue?

Thanks in advance!

Edit: import as grayscale and resize image added to one_feature in an attempt to solve the error.

Edit 2: Here's the training/testing code that I'm using

Edit 3: Here's the updated training/test code that I'm using

   for (int c = 0; c< numberOfTrainingDigits; c++) {
        // crop out 1 digit:
        digit = Imgcodecs.imread("/Users/jeremyk/Desktop/training/digit" + c + ".png");
        Mat num = new Mat();
        Imgproc.resize(digit, num, new Size(60, 110));
        // we need float data for knn:
        num.convertTo(num, CvType.CV_32F);
        // for opencv ml, each feature has to be a single row:
        trainData.push_back(num.reshape(1,1));
        trainLabs.add(c);
    }

    // Add test image
    Mat testDigit = Imgcodecs.imread("/Users/jeremyk/Desktop/testdigit.png", 0);
    Mat num = new Mat();
    Imgproc.resize(testDigit, num, new Size(60, 110));
    // we need float data for knn:
    num.convertTo(num, CvType.CV_32F);
    testData.push_back(num.reshape(1,1));
    testLabs.add(6);

    // make a Mat of the train labels, and train knn:
    KNearest knn = KNearest.create();
    knn.train(trainData, Ml.ROW_SAMPLE, Converters.vector_int_to_Mat(trainLabs));

    // now test predictions:
    for (int j=0; j<testData.rows(); j++)
    {
        Mat one_feature = testData.row(j);
        int testLabel = testLabs.get(j);

        Mat res = new Mat();
        float p = knn.findNearest(one_feature, 1, res);
        System.out.println(testLabel + " " + p + " " + res.dump());
    }
2019-07-21 05:35:08 -0500 edited answer KNearest Java Assertion Error[SOLVED]

The solution for this issue can be split in multiple attention points: Make sure that you have appropriate training im

2019-07-20 08:26:37 -0500 received badge  Student (source)
2019-07-20 08:04:03 -0500 edited question Predict trajectory of hand based on 3D coordinates

Predict trajectory of hand based on 3D coordinates Hi all, I'm looking into a way to predict the trajectory of a hand t

2019-07-20 08:03:13 -0500 edited question Predict trajectory of hand based on 3D coordinates

Predict trajectory of hand based on 3D coordinates Hi all, I'm looking into a way to predict the trajectory of a hand t

2019-07-20 08:02:59 -0500 received badge  Organizer (source)
2019-07-20 08:01:41 -0500 asked a question Predict trajectory of hand based on 3D coordinates

Predict trajectory of hand based on 3D coordinates Hi all, I'm looking into a way to predict the trajectory of a hand t

2018-06-19 03:24:48 -0500 edited question Imgproc.findContours not returning all contours

Imgproc.findContours not returning all contours Small issue again. I'm using the imgproc.findContours in Java: Imgproc.

2018-06-19 03:24:17 -0500 commented question Imgproc.findContours not returning all contours

Anyone? Really need help on this.

2018-06-17 12:26:40 -0500 commented question Imgproc.findContours not returning all contours

Hi @LBerger , Thanks for your answer! It indeed helps with getting all the edges, but I get a lot of double points.. Any

2018-06-17 11:45:39 -0500 marked best answer Can't get Canny Edge Treshold right

I'm trying to extract digits from an analog electricity meter.

I have for example following picture: image description

I know that the lightning on this picture isn't equal everywhere, but it's really hard to get this equal due to reflection and etc.

When I'm performing Grayscale, Gaussian Blur & Canny Edge on this image, I can't get a decent result. The issue is that I either have to put the Canny Edge treshold too high which causes some digits unreadable or either have to put the Canny Edge treshold too low which causes too much details to be included in the image.

Example of too high treshold: image description

Code: Imgproc.Canny(image, imgCanny, 60, 60/3);

Example of too low treshold: image description

Code: Imgproc.Canny(image, imgCanny, 35, 35/3);

Is there any way to perform some kind of 'Adaptive Treshold Canny Edge' on this? Thanks!

2018-06-17 11:45:39 -0500 received badge  Scholar (source)
2018-06-17 11:45:08 -0500 edited question Imgproc.findContours not returning all contours

imgproc.findContours not returning all contours Small issue again. I'm using the imgproc.findContours in Java: Imgproc.

2018-06-17 11:44:37 -0500 asked a question Imgproc.findContours not returning all contours

imgproc.findContours not returning all contours Small issue again. I'm using the imgproc.findContours in Java: Imgproc.

2018-06-17 11:41:40 -0500 answered a question Can't get Canny Edge Treshold right

Couldn't get it fixed with the Canny algorithm. Needed to fix the picture quality and light.

2018-06-11 06:42:52 -0500 commented question Can't get Canny Edge Treshold right

@berak , tried to keep the treshold number, but I get 116 as treshold which is way too high..

2018-06-11 05:03:13 -0500 commented question Can't get Canny Edge Treshold right

Thanks for your suggestion @berak ! I tried to use: Imgproc.threshold(image, imgCanny, 0, 255, Imgproc.THRESH_BINARY | I

2018-06-11 05:02:30 -0500 commented question Can't get Canny Edge Treshold right

Thanks for your suggestion @berak ! I tried to use: Imgproc.threshold(image, imgCanny, 0, 255, Imgproc.THRESH_BINARY | I

2018-06-11 04:34:01 -0500 received badge  Enthusiast
2018-06-10 13:12:47 -0500 commented question Can't get Canny Edge Treshold right

Thanks for this suggestion. Can you please give me some more resources or info on the gradient x and y usage? Or how it

2018-06-10 13:12:16 -0500 commented question Can't get Canny Edge Treshold right

Thanks for this suggestion. Can you please give me some more resources or info on the gradient x and y usage? Or how it

2018-06-10 12:12:43 -0500 commented question Can't get Canny Edge Treshold right

Thanks for this suggestion @LBerger, but I can't find the XImgProc in my jar or .so and it's a real pain to build these

2018-06-10 09:53:57 -0500 edited question Can't get Canny Edge Treshold right

Can't get Canny Edge Treshold right I'm trying to extract digits from an analog electricity meter. I have for example f

2018-06-10 09:53:28 -0500 asked a question Can't get Canny Edge Treshold right

Can't get Canny Edge Treshold right I'm trying to extract digits from an analog electricity meter. I have for example f

2018-04-04 09:49:09 -0500 commented question Building native libraries not working

JAVA_HOME is pointed to /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/ , isn't this correct?

2018-04-04 09:31:59 -0500 commented question Building native libraries not working

Hi Berak, everything goes perfect till one of the latest steps of the make in which I get: Target 'jar' failed with mess

2018-04-04 08:40:21 -0500 commented question Building native libraries not working

Thanks for your reply berak! :D I'm nog awaiting the build as said, but you're saying that I better just run cmake -DBUI