1

I have a series of input images like the one attached. These are images of a television screen, and transformed using Canny Edge. This is not a necessary step, but I thought it would be nicer to illustrate the issue.

What I'd like to do now is find the 4 coordinates of the edges in the big(gest) square in the image. I've taken a look at HoughTransform, but while it detects the image, I have a hard time understanding how this can give me the point of the image.

Basically, I'd like to call a method like:

public Point[] findEdges(BufferedImage image)

Is there any library, algorithm, or anything else out there which can be easily used (it's a simple hobby project) in my Java application which I haven't found yet?

enter image description here

Erik Pragt
  • 11,804
  • 10
  • 44
  • 55
  • What's the semantic value behind an array of points as a return value? Aren't you looking to perhaps get a LineSegment[] instead, where each LineSegment describes its endpoints? – nanofarad Sep 12 '14 at 23:04
  • LineSegments, or Points, either are valid options I guess. What I'd like to do is pick some points inside the rectangle and detect the color of the pixel, and based on those pixels color the lights in my room. A sort of Ambilight, but using a webcam. – Erik Pragt Sep 12 '14 at 23:07
  • Google for "detecting squares in images", there are plenty of options. [**Related question here**](http://stackoverflow.com/questions/8667818/opencv-c-obj-c-detecting-a-sheet-of-paper-square-detection) – Dan Sep 12 '14 at 23:11
  • Hi Dan, thanks for the link, but these examples use OpenCV. The Java version is very incompatible with this since version 0.8, and seems a more complex solution than I'd prefer right now. – Erik Pragt Sep 12 '14 at 23:32
  • Also related: http://stackoverflow.com/questions/7072740/how-can-i-detect-basic-2d-geometric-shapes-e-g-square-triangle-circle-on-a – Dan Sep 12 '14 at 23:37
  • 2
    Dan, the image above is created using an edge detector (Canny Edge), but doesn't do what you think it does. Besides that, Marvin is very unfriendly in it's distribution (ie. is not available in Maven repos) – Erik Pragt Sep 12 '14 at 23:46
  • "but doesn't do what you think it does"? – Dan Sep 12 '14 at 23:51
  • Sorry, what I meant was: doesn't detect the outer edges but finds the edges in color ranges, like in the image above. – Erik Pragt Sep 13 '14 at 06:58
  • Are you still interested in this? I think that Hough Transform *could* be a way to go, and I considered elaborating this in an answer (not sure how far I could/should/would go there, but I could give some hints) – Marco13 Nov 23 '16 at 17:39

0 Answers0