Ask Your Question
0

Plot angle vs intensity histogram from image center

asked 2018-11-07 15:39:52 -0600

nick_leo gravatar image

Basically I'm selecting a circular area in the image(gray scale DFT image) where image center coordinates are the center of the circle.I want to plot angle vs intensity variation for the area covered by this circle.My idea is to use a virtual line through image center with the length of circle diameter and move by 1 degree and sum up total pixel intensity values covered by that line.Similar approach is mentioned in below links,

finding-intensity-along-a-moving-line-in-an-image-and-compiling-to-give-an-angle-vs-intensity-plot

how-to-plot-intensity-images-i-e-any-angle-between-0-and-360-degree

I would like to know is it possible to achieve such a thing using OpenCV + python (It seems not that easy)? Or is there any other approach for plotting angle vs intensity histogram through image center?

I was initially thinking to get logPolar transform of the image and access angle and intensity values from it.But i was not sure whether it was a possible approach since i couldn't even interpret logPolar transform output in an informative manner.(It just returns logploar transformed image, not angle and log magnitude vectors from the image center)

Any suggestions would be appreciated...

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2018-11-20 16:56:47 -0600

nick_leo gravatar image

updated 2018-11-20 17:24:19 -0600

Thanks for the suggestions.I think it is better to explain the approach i took for any future reference.

  1. I've used OpenCV with Numpy
  2. Apply a circular convolution for my DFT image after low frequency components are moved to the image center
  3. A dictionary is defined with key : angle and values : intensity values of pixels with same angle
  4. While iterating through each row(i) and column(j) , calculated pixel(i,j) angle with respect to the image center (I,J) using np.arctan2(I - i , J - j) and updated the dictionary

Note : Even though this method is working, you'll notice that angles such as 0, 45, 90, 180 has way more pixel points than others.This is due to square shape of pixels.

edit flag offensive delete link more
0

answered 2018-11-08 01:06:20 -0600

berak gravatar image

opencv is a computer-vision library, and not really suitable for plotting.

also, logPolar / warpPolar seem to be the opposite of what you wanted.

there's phase(), magnitude(), polarToCart() to retrieve useful information, but in the end, this is not the appropriate library for your job (imho).

edit flag offensive delete link more

Comments

1

Thanks for the reply.Really appreciate it.But i like to clarify somethings in here.

I'm not really worrying about the plotting.It can be done using some other library.My concern is that, is it possible in OpenCV to access intensity values all the pixels of an image that make same angle (clockwise or counterclockwise) with the image center?

Seems in-built functions you have mentioned in here are not useful in my scenario since, 1. Angle is measured in these functions respected to the origin instead of center 2. I can't directly apply polar coordinates since my requirement is not depending on both angle and magnitude values.Instead it is only based on angle.

nick_leo gravatar imagenick_leo ( 2018-11-08 01:48:20 -0600 )edit

yea ;( it also seems, you're not even using opencv's dft (which is not "centered" by default)

the c++ api has a LineIterator class, which would allow you to traverse the radius for a given angle, and sample the underlying Mat (that's more or less, what your links there proposed, no ?, but not available in python.

berak gravatar imageberak ( 2018-11-08 02:04:02 -0600 )edit
1

Aboutsection I use this

For radial distribution I use this https://github.com/LaurentBerger/wxOp...

LBerger gravatar imageLBerger ( 2018-11-08 03:04:11 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-07 15:38:09 -0600

Seen: 1,210 times

Last updated: Nov 20 '18