Ask Your Question

kbarni's profile - activity

2020-12-07 08:03:52 -0600 answered a question getting out of arguments

Another solution that I often use is to create a text file containing the image names and pass that filename as argument

2020-12-03 09:37:46 -0600 asked a question Per-pixel operations in Python

Per-pixel operations in Python I'm working on some image processing algorithm* in Python where I need to do some per-pix

2020-12-02 04:10:52 -0600 commented question installing 3.4.12 for ubuntu 18.04 LTS (install from source) for yolov4

What cmake configuration options did you use? Did you try compiling it without OpenCL support?

2020-12-01 11:24:36 -0600 answered a question Birdseye transform with getPerspectiveTransform

But my question now is how do I translate the coordinates of the centroids to the soccerfield image. DO NOT transla

2020-11-30 01:03:26 -0600 marked best answer Best practices for writing image processing functions?

I've been thinking for some time, which is the best method to declare an image processing function?

The function should take an input image and return an output image.

I can think of the following possibilities:

  1. using InputArray & OutputArray:

    void foo(InputArray in,OutputArray out)
    {
        Mat inMat=in.getMat();
        out.createSameSize(in,CV_8U);
        Mat outMat=out.getMat();
        // processing code...
    }
    
  2. Using two Mat variables as parameters:

    void foo(Mat in,Mat out)
    {
        out.create(in.size(),CV_8U);
        // processing code...
    }
    

    BTW, in this case which parameters should be declared with &? (i.e. Mat &in)

  3. One Mat as parameter and return a new Mat:

    Mat foo(Mat in)
    {
        Mat out(in.size(),CV_8U);
        // processing code...
        return out;
    }
    

In classical C++ code, the third method should be normally preferred, but I think the other two can be more optimal in certain cases (i.e. using foo(img,img) vs. img=foo(img) or when the out matrix was already created)?

Concerning the first two solutions, I think they are mostly equivalent, however OpenCV uses systematically InputArray and OutputArray as parameters. Is there a good reason for this, or is it's for better readability? I am also aware that InputArray and OutputArray are more general, they can accept other parameters then Mat variables, too.

2020-11-25 10:31:12 -0600 commented question Adding subtitles from .srt file C++

...and OpenCV doesn't have its own codecs, it uses 3rd party libraries...so you cannot avoid dependencies to other libra

2020-11-24 04:09:37 -0600 commented question Perspective warping using QR codes as anchors in the image

Use ArUCo markers instead of QR codes. They are better suited for this kind of application. Use at least 3 or 4 markers

2020-11-19 11:32:37 -0600 commented question How to eliminate Text underline?

What did you try? Did you bother to search for a solution? Hint: the HoughLinesP function is what you are looking for.

2020-11-19 11:32:05 -0600 commented question How to eliminate Text underline?

What did you try? Did you bother to search for a solution? Hint: the HoughLinesP function is what you are looking for.

2020-11-18 08:35:35 -0600 edited answer How to Darken Faint/Dim Gray Text

Use the so-called gamma correction. The formula is: result = 255 * (image/255)^k With different k exponent values yo

2020-11-18 08:35:00 -0600 edited answer How to Darken Faint/Dim Gray Text

Use the so-called gamma correction. The formula is: result = 255 * (image/255)^k With different kexponent values you

2020-11-18 08:33:12 -0600 answered a question How to Darken Faint/Dim Gray Text

Use the so-called gamma correction. The formula is: result = 255 * (image/255)^k With different k values you can have

2020-11-18 08:23:46 -0600 answered a question Speeding up reading PNG images

PNG compression is computationally expensive. If this is a bottleneck of your application, you should choose another fil

2020-11-13 03:07:06 -0600 commented question Obstacle detection on the street

don't use OpenCV 2.4. It's a very outdated version! There is no magic "detectObstaclesToHelpBlindPeople()" function. So

2020-11-12 11:50:32 -0600 commented answer Line endpoint detection

create a new black image for storing the endpoints for the endpoints (points having only one neighbor in the skeleton)

2020-11-11 11:45:33 -0600 answered a question line extension beyond 2 points how to extrapolate

There is no function to extend a line in OpenCV. Fortunately this is a simple geometry problem. The formula for your li

2020-11-11 05:20:22 -0600 answered a question Line endpoint detection

Probably you can tune the parameters of the probabilistic Hough transform to detect all the lines; however it will somet

2020-11-11 05:09:54 -0600 commented question The mask must be 8-bit 1-channel image in function 'icvInpaint'

yes. The mask must be a 8-bit 1-channel (i.e. grayscale) image. What's the problem?

2020-11-11 05:09:00 -0600 edited question The mask must be 8-bit 1-channel image in function 'icvInpaint'

The mask must be 8-bit 1-channel image in function 'icvInpaint' import numpy as np import cv2 from PIL import Im

2020-11-11 05:08:24 -0600 edited question The mask must be 8-bit 1-channel image in function 'icvInpaint'

The mask must be 8-bit 1-channel image in function 'icvInpaint' import numpy as np import cv2 from PIL import Im

2020-11-11 05:08:03 -0600 edited question The mask must be 8-bit 1-channel image in function 'icvInpaint'

The mask must be 8-bit 1-channel image in function 'icvInpaint' import numpy as np import cv2 from PIL import Im

2020-11-03 04:28:24 -0600 commented question Consistently failing to compile openCV with RPi 3B+

Also, first try to use the official install docs: https://docs.opencv.org/4.5.0/d7/d9f/tutorial_linux_install.html They

2020-11-03 04:20:26 -0600 answered a question Color threshholding only outputs edge for green color.

This is normal. The color of the green squares is (BGR) 79,155,108, which is outside the lower_green - upper green range

2020-10-27 10:22:16 -0600 commented question using open cv to control relay

And your problem is...? What did you try? It seems that you didn't invest the minimal effort to solve this.

2020-10-27 04:30:06 -0600 commented question Algorithm suggestion for texture image matching

The article suggested by Eduardo is a great resource. Concerning the implementations, the Gabor filters can be a good s

2020-10-27 04:18:24 -0600 commented question Algorithm suggestion for texture image matching

The article suggested by Eduardo is a great resource. Concerning the implementations, the Gabor filters can be a good s

2020-10-26 12:29:32 -0600 commented question How to remove black stamp from an image

I think the problem with these stamps is that the degraded image differs a lot from the original. The original can conta

2020-10-08 15:29:41 -0600 received badge  Nice Answer (source)
2020-09-15 04:08:24 -0600 commented question Opencv multiple bubble detection in a image

HoughCircles...?

2020-09-10 03:23:12 -0600 answered a question Opencv multiple circle detection in a image

Try the DistanceTransform, it's another good method for circle detection in binary images. This example should help.

2020-09-02 13:53:46 -0600 answered a question Way to distinguish two different textures without dataset

Well, this seems as a classical texture analysis problem. There are some robust texture descriptors which can be used t

2020-09-02 04:20:22 -0600 commented question Locate specific pixel from left and right view on the disparity map

For a pixel from the left camera PL(X,Y) the corresponding pixel in the disparity map has the same coordinates PD(X,Y).

2020-08-28 11:15:44 -0600 answered a question I install OpenCv in a raspberry pi 3 with c++

Windows doesn't run on the Rasp. But Linux (Raspbian) is simple...just get used to the fact that it's different than Win

2020-08-27 05:48:30 -0600 answered a question How can I detect curved line?

Curve detection is not simple in image processing. AFAIK there is no standard way for doing it (like the Hough transform

2020-07-29 06:19:27 -0600 answered a question Finding corner points for perspective transform without clear landmarks.

I think Yolo is a bit overkill for ball detection, but you can keep if it works. You might also try HoughCircles. The i

2020-07-29 06:00:38 -0600 commented question Finding corner points for perspective transform without clear landmarks.

I think Yolo is a bit overkill for ball detection. You might try HoughCircles, or the inRange function and then Connecte

2020-07-27 10:27:24 -0600 answered a question Join floating white pixels to the nearest island without closing morph?

Run the ConnectedComponentsWithStats function on the image. Get the smallest surfaces, as zones to merge. Then, for ea

2020-07-27 10:08:49 -0600 commented question Block until window closed

I'm using Ubuntu and OpenCV 4.3. I have to check on windows...

2020-07-27 10:06:43 -0600 commented answer Apply getPerspectiveTransform and warpPerspective for bird-eye view (Python).

Yes, the best solution would be to use 4 visible and fixed red balls or points. I also like to use ARUCO markers for cal

2020-07-27 10:04:43 -0600 edited answer Block until window closed

A minute of googling could have made you find out that you can use getWindowProperty() to check whether the window is ok

2020-07-27 09:59:26 -0600 commented answer Apply getPerspectiveTransform and warpPerspective for bird-eye view (Python).

Yes, the best solution would be to use 4 visible and fixed red balls or points. I also like to use ARUCO markers (in oth

2020-07-27 09:27:11 -0600 commented answer Apply getPerspectiveTransform and warpPerspective for bird-eye view (Python).

You'll need some markers for calibration. Either add some colored points to the field that you can use for calibration o

2020-07-27 08:14:33 -0600 answered a question Apply getPerspectiveTransform and warpPerspective for bird-eye view (Python).

WarpPerpective will transform a rectangle seen in perspective (like a trapeziod) into a real rectangle. For it to wor

2020-07-25 07:58:00 -0600 marked best answer Block until window closed

I would like to display a window, and block the program execution until the user decides to continue. This is done normally the following way:

Mat img1,img2;
//...process...
namedWindow("Image1",WINDOW_NORMAL);
imshow("Image1",img1);
waitKey();
destroyAllWindows();
namedWindow("Image2",WINDOW_NORMAL);
imshow("Image2",img2);

The only problem with this approach is if the user instinctively closes the window using the X button. Then, as no HighGUI windows are active, waitKey() will never return and the program blocks.

Is there any solution, so the program waits a keypress OR the window to be closed?

2020-07-24 10:15:40 -0600 asked a question Block until window closed

Block until window closed I would like to display a window, and block the program execution until the user decides to co

2020-07-24 09:46:05 -0600 edited answer Will pay for libopencv_java.so v2.4.9 - arm64-v8a

It's possible that you'll need the OpenCV bindings too, not only the libopencv_java.so (never tried, I don't use Java).

2020-07-24 09:44:32 -0600 answered a question Will pay for libopencv_java.so v2.4.9 - arm64-v8a

It's possible that you'll need the OpenCV bindings too, not only the libopencv_java.so (never tried, I don't use Java).

2020-07-17 10:57:55 -0600 answered a question show video and texts on single window

Create 2 images, one with the video feed (let's say 640x480), the other one with the text (in this case 160x480). Then u