0

I am trying to extract the horizontal / vertical lines from (incomplete) grid points. Here is simplified example:

% grid(): 2D matrix containing actual grid points, which are unknown
% points(): 1D matrix containing found grid points, which are incomplete
% assuming 5X5 grid

points = [grid(1,1);grid(1,2);grid(1,3);grid(1,4);
          grid(2,1);grid(2,3);grid(2,4);grid(2,5);
          grid(3,1);grid(3,2);grid(3,3);grid(3,4);grid(3,5);
          grid(4,1);grid(4,2);grid(4,3);grid(4,4);grid(3,5);
          grid(5,1);grid(5,2);grid(5,4);grid(5,5)];

The result what I expect is:

  • Finding the line equations of each column & row by regression. In this case, the set contains 5 horizontal and 5 vertical equations: For example, param_row(5,2) and param_column(5,2) would be the parameter set for each 1D line (y=ax+b)
  • Complete grid() matrix by calculating the cross point between horizontal and vertical equations. I this case, grid(1,5);grid(2,2);grid(5.3) should be obtained

Thanks for help.


EDIT:

https://drive.google.com/file/d/0B_UjxbISeZDrZDlWaV9ZaXVtbmc/view?usp=sharing

Here is the (binary) grid image what I should handle (I couldn't post image on the main text). The position of ON pixels are stored at point(). In this image, grid() are the set of cross points among the fitted horizontal / vertical lines. So, "Complete grid() matrix" means finding missed points on the image.

clockoon
  • 1
  • 1
  • So `grid(1,5);grid(2,2);grid(5.3)` are `NaN`? You want to extrapolate to those unknown points? Are the values on `grid` a linear function? Is there noise present? – knedlsepp Feb 13 '15 at 02:25
  • @knedlsepp `grid()` is virtual data set, so I must estimate these values. Also it contains the noise; that's the reason why I try regression. – clockoon Feb 13 '15 at 07:04
  • What do you mean by virtual data set? Care giving us some example data? – knedlsepp Feb 13 '15 at 10:03
  • @knedlsepp https://drive.google.com/file/d/0B_UjxbISeZDrZDlWaV9ZaXVtbmc/view?usp=sharing Here is the (binary) grid image what I should handle (I couldn't post image on the main text). The position of ON pixels are stored at `point()`. In this image, `grid()` are the set of cross points among the fitted horizontal / vertical lines. So, *"Complete grid() matrix"* means finding missed points on the image. – clockoon Feb 13 '15 at 10:26
  • 1
    This is a lot different from your original question! If you want this, better ask it directly! Will these grid points ever be rotated? – knedlsepp Feb 13 '15 at 10:31
  • Also: How can 2D-positions be stored in the single matrix `point`? – knedlsepp Feb 13 '15 at 10:42
  • @knedlsepp As you see on the image, the points are initially bit rotated, however the original image would never be changed. That's why I thought about the regression. – clockoon Feb 13 '15 at 10:42
  • The data structures you are describing don't match the problem. – knedlsepp Feb 13 '15 at 10:43
  • @knedlsepp I stored the position matrix by the code like: `[point(:,1) point(:,2)] = find(BW==1);`. So it contains position data only, not about the row or column information. – clockoon Feb 13 '15 at 10:45
  • Yes, But you say *1D matrix containing found grid points* – knedlsepp Feb 13 '15 at 10:45
  • I would suggest to you that you delete this first `find` step you have done from your question and ask directly: Given an image like you got, blablabla. – knedlsepp Feb 13 '15 at 10:47
  • @knedlsepp That's my fault. I wrote *1D* meaning *lack of the row or column information*. – clockoon Feb 13 '15 at 10:49
  • @knedlsepp I understand. I will re-write the question. Thanks for advice. – clockoon Feb 13 '15 at 10:50
  • In the meantime: [This](http://stackoverflow.com/questions/16476367/grid-detection-in-matlab) might be an interesting read. – knedlsepp Feb 13 '15 at 11:01
  • You should probably also explain how the images you are trying to process differ/are the same. Like: Will the spacing of the points always be uniform? Will the grid size always be 13x14? Will the white points in the image always be single pixels? – knedlsepp Feb 13 '15 at 11:16

0 Answers0