Re: Finding a square pattern in an image
- From: "Stewart DIBBS" <sjd@xxxxxxxxx>
- Date: Wed, 25 May 2005 20:16:08 -0400
"r@i" <punit.raizada@xxxxxxxxx> wrote in message
news:1117057562.519551.78830@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> I am very new to the world of image processing. I am working on a
> project that requires me to process image frames and locate the
> position ( all the four corners) of a square in that image.
>
> These are the steps I have followed till now
> 1) Convert the input image to grayscale.
> 2) I set an arbitrary threshold:
> (max_intesity + min_intensity) /2
> 3) I move horrizontally in the image, looking for edges.
>
> Is there any known alogrithm that I can use that would allow me to
> locate a square shape in the image ?
Of course. The simplest method is to identify the pixels in the square, or
conversely, those pixels not in the square. This assumes that the square is
filled, not just outlined.
What you are trying to do is identify an object in the image, not find a
square, at least, not to start with.
An arbitrary segmentation is not much use initially, so you need some method
to identify the pixels in the square. If you take a histogram of the image,
you should see some range of pixel values that define the square region vs
all the rest of the pixels. This range is used to set the segmentation
point(s). If the image can be turned to 8 bit grayscale, all the better, as
there's only 256 levels or less to check. This is OK because all you have to
do is identify the corners.
Scan through the image line by line, and set the pixel to 255 if >
segmentation_value, or 0 if < segmentation_value. You've now identified the
OBJECT, but you don't know if its a square yet.
Scan again, and look for the 255 value pixels. If the square edge is on a
scan line, its clear enough where the corners are. If square is not aligned
with the scan lines, the problem is a bit harder, but if you can assume that
a corner == one pixel in a scan line, its a simple exercise.
You could probably combine both scans into one pass: two is simpler to
describe.
I've been deliberately a bit vague here. Draw out the various possibilities
on paper, and you should be able to see how to do the project.
regards,
Stewart DIBBS
========================================
Developer of the PiXCL Image Processing and
Analysis Language for Windows 2000/XP
PiXCL 6.0 is available now !
www.pixcl.com Gatineau, Quebec, CANADA
========================================
.
- Follow-Ups:
- Re: Finding a square pattern in an image
- From: r@i
- Re: Finding a square pattern in an image
- References:
- Finding a square pattern in an image
- From: r@i
- Finding a square pattern in an image
- Prev by Date: Finding a square pattern in an image
- Next by Date: What colors or color model to use for skin detect
- Previous by thread: Finding a square pattern in an image
- Next by thread: Re: Finding a square pattern in an image
- Index(es):
Relevant Pages
|
|