Finding angle between 2d vectors with a four quadrant approach

10 ビュー (過去 30 日間)
Atreya Danturthi
Atreya Danturthi 2021 年 6 月 14 日
コメント済み: Jonas 2021 年 6 月 14 日
I am using Image Processing techniques to extract certain features (circular, not completely circular by the shape) in an image (these features cannot be extracted with the in-built image processing functions). In the approach, I have applied certain conditions such as brightness threshold, gaussian blur and few other conditions to obtain the centres of the circular features in the image (and plotted the same using markers) so that I can later on detect the boundaries of the same.
Whilst trying to find the centres for the features, I have assumed that there is not change in pixel intensity at the centre of the each of the circle (which is true in my case) and therefore found out the gradient of intensity (if plotted with the quiver plot are essentially vectors) across the image and few other conditions to find out the centres. To reduce the number of false positives, I have increased the number of conditions, one of which is that angle between the vectors in the neighbourhood of the vectors must be ~180deg (i.e., if we consider a vector at a position (i,j), the neighbouring vectors at a distance of say 4 pixels to the left (i-4,j) and right (i+4,j) respectively need to have and angular diff. of ~180deg between them.
To apply this condition, I need to find out the angle between the vectors using the tan function rather than the cos function as cos function gives a 2 quadrant answer which is not useful for my question.

採用された回答

Jonas
Jonas 2021 年 6 月 14 日
have a look into the atan2() function which takes the y and x coordinate of your vector
  2 件のコメント
Atreya Danturthi
Atreya Danturthi 2021 年 6 月 14 日
I have already tried out the atan2 function, but unfortunately it is not viable for me as I do not have the coordinates for my vector.
Is there any other approach with respect to tan function or any other way to find out the coordinates of the same?
Jonas
Jonas 2021 年 6 月 14 日
ok your title says you have 2d vectors. if you don't have thise, can you give an image or some kind of impression what you already have?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by