Ask Your Question

Revision history [back]

Computing radial average of the autocorrelation of a binary image

Hello, I am a new user of OpenCV. I need to extract the typical distance between patches in a set of images I have. As I understand the right way to do it is performing the radial average of the autocorrelation of the image.

Is there a smart way to do it on OpenCV? I tried to search on this topic but haven't found something useful..

My data is originally a jpg image, black and white, and I convert it to binary image using OpenCV image thresholding(not sure that I did it right). The question is how now I convert the 2D binary matrix or ones and zeros to a list of the coordinates of only the ones. The basic code line is this one:

import numpy as np
import cv2
import matplotlib.pyplot as plt

im_normal = cv2.imread('example.jpg')
im_gray = cv2.imread('example.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE)
(thresh, im_bw) = cv2.threshold(im_gray, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)

As an example for an image I attach here this one -patches