0
$\begingroup$

I struggle to find this, suppose I apply any feature detection algorithm. From my references it seems to me it's not usually explained what kind of data structures would be suitable for storing such features.

For example in opencv it seems to me that the Canny Edge detector will return a matrix (I assume the code/gray level code is like relating high pixel value with the the feature in that specific pixel). I think it would be useful to know what data structures could actually be useful in this case to navigate through all the extracted features instead of iterating through all the pixels.

So the question is... in general (or at least line features) what data structure is usually useful? and how is such data structure constructed?

As a specific example... I'd like to extract all the edges of a given image, name such edges $e_1,\ldots,e_n$. Then I need to access to the pixels that lie both to the left and right of such edge(not all, just pixels that are close enough to $e_i,ドル for all $i$). Finally I need to perform some operations on such pixels.

To summarize something like:

$e_1,\ldots,e_n \leftarrow extractEdges(I)$

$\forall i \in \left\{ 1,\ldots, n\right\}$

$\;\; S_l \leftarrow pixelsLeft(e_i)$

$\;\; S_r \leftarrow pixelsRight(e_i)$

$\; \; doSomething(S_l,S_r)$

Above $I$ representes the input image.

Thank you

asked Jul 23, 2018 at 15:03
$\endgroup$
0

1 Answer 1

1
$\begingroup$

A simple solution would be a 2D array containing a 1 in the locations that are detected as an edge, or a sparse 2D matrix. A more sophisticated solution would be a quadtree.

answered Jul 23, 2018 at 20:53
$\endgroup$
4
  • $\begingroup$ Any references for such approach? I mean the quad tree $\endgroup$ Commented Jul 23, 2018 at 21:15
  • $\begingroup$ @user8469759, if you google it you will probably find a Wikipedia article. I encourage you to be resourceful and I'm sure you will be able to find many resources on the subject. Please don't use comments for follow-up questions; you can ask a new question using the 'Ask Question' button, after doing some research. $\endgroup$ Commented Jul 23, 2018 at 22:48
  • $\begingroup$ There's still a bit I don't understand, say you use a sparse matrix to store pixels corresponding to edges. How would you take into account whether or not given two pixels these belong to the same edge? One could look for adjacent pixels, but it might be possible that these two would belong to two adjacents edges. $\endgroup$ Commented Jul 24, 2018 at 8:45
  • $\begingroup$ @user8469759, I don't know; that wasn't part of the question. The Canny edge detector doesn't tell you whether or not two pixels belong to the same edge; you have to do some preprocessing for that. Presumably, you'll have to do the same preprocessing if you want to use one of these data structures, and then encode which edge it is part of (e.g., assign a unique ID to each edge, and store that ID in the corresponding location of the matrix instead of a 1). $\endgroup$ Commented Jul 24, 2018 at 15:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.