Ask Your Question

Abid Rahman K's profile - activity

2020-10-25 05:50:47 -0600 received badge  Popular Question (source)
2020-09-29 03:02:10 -0600 marked best answer Weird result while finding angle

Hi

I wanted to find the angle of a curve at every pixel. For that, I applied canny edge detection. For test image, i took a filled rectangle. So obviously, canny edge result is just a rectangle.

Then i applied Sobel derivative in x and y direction and to find the angle, i took arctan(dy/dx). ( dx = dx+0.001 to avoid divide by zero)

For vertical side, i got an angle of 0 which is true since dy=0 in vertical direction and dx is some high value.

But for horizontal side also, i got zero. I don't understand why. When i took its corresponding dx,dy values, dx = 0.001... and dy = 0. Isn't it wrong to get dy = 0 on the horizontal side of the rectangle?

I checked the dy image, and it clearly shows the top and bottom sides of the rectangle. But still, why dy = 0 on that side?

Below is my dx image:

image description

My dy image:

image description

2019-09-21 10:25:19 -0600 received badge  Popular Question (source)
2019-04-07 03:28:10 -0600 received badge  Self-Learner (source)
2018-12-12 01:45:49 -0600 received badge  Notable Question (source)
2018-09-23 16:12:03 -0600 marked best answer Problem with Github OpenCV repo

Hi,

I tried to clone OpenCV github repo using the command :

git clone git://code.opencv.org/opencv.git

But it is too slow (<10 KBps) and got stuck twice. I checked both in Linux and Windows.

There is no problem with my internet connection. Normal download give me a speed of >500 KBps.

So I decided to download zip file. Is it possible to extract this zip file my local folder and make this folder to work as my personnel Opencv git repo just like a cloned repo? If so how?

2018-05-17 09:47:15 -0600 received badge  Famous Question (source)
2018-02-12 01:41:57 -0600 received badge  Famous Question (source)
2017-07-15 02:16:28 -0600 received badge  Famous Question (source)
2016-09-19 09:40:36 -0600 received badge  Notable Question (source)
2016-06-03 04:41:16 -0600 received badge  Notable Question (source)
2016-03-21 03:00:41 -0600 received badge  Notable Question (source)
2016-01-29 14:47:16 -0600 received badge  Nice Answer (source)
2015-10-22 05:58:33 -0600 received badge  Popular Question (source)
2015-09-17 00:43:19 -0600 received badge  Good Answer (source)
2015-09-16 18:15:27 -0600 received badge  Good Question (source)
2015-08-27 06:33:34 -0600 received badge  Nice Question (source)
2015-07-15 02:00:08 -0600 received badge  Popular Question (source)
2015-07-09 06:21:13 -0600 received badge  Popular Question (source)
2015-06-24 01:20:02 -0600 received badge  Nice Answer (source)
2015-04-17 01:29:16 -0600 received badge  Popular Question (source)
2015-03-26 10:23:43 -0600 marked best answer OpenCV-Python build problem in Windows with Master branch

Hi,

I am trying to build OpenCV master branch with Visual Studio 2010 and Python support. But CMake always shows:

Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (Required is exact version "2.7.3")

So python is disabled automatically. Below image shows Python fields in Cmake gui.

image description

All fields are filled here. And I couldn't find a field with PYTHON_INCLUDE_DIRS anywhere. Also, BUILD_opencv_python is also missing.

So what goes wrong here?

2014-12-09 14:09:42 -0600 marked best answer Epilines not correct

Hi,

I am trying to draw epilines on two images. But only one is shown correctly. See my result below:

image description

Epilines on the first image (left) seems to be correct since epipole matches with location of second camera. But what about the second image. I expected it to be converged somewhere at left, but it is not. Any idea what is the reason?

Here is my code : https://gist.github.com/abidrahmank/6146351

UPDATE:

Just interchanging input images (img1 and img2) gives me following result which looks more better. (But it works only on this set of images)

image description

Why does it happen like this?

2014-12-09 14:05:20 -0600 marked best answer How Python API is generated?

How Python bindings are generated?

Hi,

1 - How is Python API of OpenCV (cv2 version) generated ? Is it created using SWIG ?

  1.a) If it is SWIG created, where I can find the SWIG interface files?

2 - What programming skills and knowledge does one require to correct if any bugs or mistakes in the Python bindings?

2014-12-09 14:03:02 -0600 marked best answer Area of a single pixel object in OpenCV

Hi,

My question seems to be simple.

Consider I have a black image with a single white pixel in it. When I find the contour, its location is returned.

But when I find its area, it returns 0.0. Why is that ? Isn't should be '1'?

And result is same with using moments.

I thought area is number of pixels that comprises that contour. But now it is not.

Can anyone clear this to me?

Regards Abid Rahman K

2014-12-09 14:02:33 -0600 marked best answer OpenCV master branch compilation issue

Hello,

I am trying to compile OpenCV from master branch. I don't need any GPU functionalities. So I passed following CMake statement:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_cuda=OFF -D BUILD_opencv_cudaarithm=OFF -D BUILD_opencv_cudabgsegm=OFF -D BUILD_opencv_cudacodec=OFF -D BUILD_opencv_cudafeatures2d=OFF -D BUILD_opencv_cudafilters=OFF -D BUILD_opencv_cudaimgproc=OFF -D BUILD_opencv_cudalegacy=OFF -D BUILD_opencv_cudaoptflow=OFF -D BUILD_opencv_cudastereo=OFF -D BUILD_opencv_cudawarping=OFF -D ANT_EXECUTABLE=NO -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_DOCS=OFF -D WITH_OPENCLAMDFFT=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_VTK=OFF ..

But I get the following error on make

[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/opencl_kernels.cpp.o
Linking CXX shared library ../../lib/libopencv_core.so
/usr/bin/ld: cannot find -lopencv_cudev
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_core.so.3.0.0] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2

What is this error? How can I solve it?

Output of CMake statement is here: http://pastebin.com/ns9tNEtf

2014-12-09 13:55:29 -0600 marked best answer Location of Epipole

Hi,

I was checking on epipolar geometry, trying to draw the epipolar lines. From reading, what i understood is that epipole of image 1 is the projection of camera center-2 if both images were taken together. And all the epilines pass through these epipole.

I attached two images,

in epi1.jpg, I drew epilines in left image for the corresponding points in the right image. Intersection of epilines shows the projection of camera of right image which seems to be correct in this case.

image description

But in second image, I expected epipole to be outside the image since camera projection of right image can't be inside the left image since camera in left image is in front of camera of right image. But I got epipole to be inside. How is it possible?

image description

(Sorry if i confused you)

This is my code: https://gist.github.com/abidrahmank/6121536

Regards Abid K.

2014-12-09 13:53:55 -0600 marked best answer Problem in the result of kNN

Hi,

I have been working with kNN in OpenCV.

I simply passed some (x,y) coordinates as samples data for kNN and their index as responses. Then I gave a (x,y) value to find the nearest neighbour ( I took this case to visualize it easily). It works fine if k=1. But when I pass k=3, i get weird result. As per my knowledge, knn.find_nearest() returns following things:

retval - I don't know what it is results - It has the label of nearest neighbour. neighborResponses - labels of k nearest neighbours with distance in increasing order. dists - Their corresponding distances in increasing order

In short, results and neighborResponses[0] should give the same result, right? But I am not getting it. See some examples below:

result    neighborResponses           dists
----------------------------------------------------------------------------
[[ 1.]]    [[ 19.  16.   1.]]        [[  36.  293.  338.]]
[[ 2.]]    [[ 24.   2.  21.]]        [[ 306.  490.  557.]]
[[ 1.]]    [[  4.  10.   1.]]         [[  65.  185.  464.]]

See, the result shows not the one with lowest distance. Why it is like that? Or did I understand it wrong ?

2014-12-09 13:53:49 -0600 marked best answer Avoid gpu modules while building

Hi,

I have installed opencv master branch in fedora x64 machine and it is working fine.

I am looking into Python bindings development. So I am not installing CUDA, Java etc. So when I make changes in code for Python, to test it is working, I rebuild it. And I feel like it is taking a lot of time. (A couple of minutes multiplied several times is a lot of time). I have already switched off the examples, performance tests etc.

I saw a lot of folders related gpu development. Since I am not using them, can I "switch it off" while building, so that it saves some time? If so how? And what else I can do to reduce the building time.

2014-12-09 13:52:50 -0600 marked best answer C++ samples don't run with master branch

Hi,

I build OpenCV master branch from github in fedora18 x64 machine. But the C++ samples don't run. It throws following error:

./a.out: error while loading shared libraries: libopencv_gpuarithm.so.2.4: cannot open shared object file: No such file or directory

But when I checked installation folder, the file is there. Moreover, python bindings are working fine. It also worked fine in OpenCV 2.4.5. Anyone have any idea what is the problem here?

More details, if needed, will be provided.

2014-12-09 13:52:48 -0600 marked best answer cv2.split() doesn't work beyond 512

Hi, I have an array of size (10,10,1000) and I want to split it into 1000 arrays of 10x10. So I used cv2.split() function for that. But it doesn't work.

So, on close examination, I saw that cv2.split() doesn't work for arrays with depth more than 512.

See below :

In [101]: j = np.arange(3*3*512).reshape((3,3,512)); k = cv2.split(j); print len(k)
512

In [102]: j = np.arange(3*3*513).reshape((3,3,513)); k = cv2.split(j); print len(k)
1

What is the problem here ? Is it a bug or is there anything else to do to make it work ?

2014-12-09 13:52:29 -0600 marked best answer Angles in ellipse() function

Hi,

I am trying to draw an ellipse using OpenCV. But I have difficulty in understanding its angle arguments. Even it is not clear from the picture in OpenCV docs.

I tried following line:

cv2.ellipse(img,(256,256),(200,100),0,90,180,(0,0,255),4,cv2.CV_AA)

I got the result as below:

image description

That means startangle is taken from positive x axis in clockwise direction and that is same for endangle.

Now I tried this :

cv2.ellipse(img,(256,256),(200,100),0,45,225,(0,0,255),4,cv2.CV_AA)

I got the output as below :

image description

See, the startangle and endangle is not 45 and 225 here.

What is the problem here? Did I miss something ? Or is it a bug?