Pixel Manipulations

P

PyPK

Does anyone know of a simple implementation for detecting straight line
..So something like if we have a 2D arary of pixel elements representing
a particular Image. How can we identify lines in this Image.
for example:

ary =
{{1,1,1,1,1},
{1,1,0,0,0},
{1,0,1,0,0},
{1,0,0,1,0},
{1,0,0,0,1}}
So if 'ary' represents pxl of an image which has a horizontal line(row
0),a vertical line(col 0) and a diagonal line(diagonal of ary). then
basically I want identify any horizontal or vertical or diagonal line
anywhere in the pxl array and return true if its composed of only lines
else false...
 
H

Howard

PyPK said:
Does anyone know of a simple implementation for detecting straight line
.So something like if we have a 2D arary of pixel elements representing
a particular Image. How can we identify lines in this Image.
for example:

ary =
{{1,1,1,1,1},
{1,1,0,0,0},
{1,0,1,0,0},
{1,0,0,1,0},
{1,0,0,0,1}}
So if 'ary' represents pxl of an image which has a horizontal line(row
0),a vertical line(col 0) and a diagonal line(diagonal of ary). then
basically I want identify any horizontal or vertical or diagonal line
anywhere in the pxl array and return true if its composed of only lines
else false...

Not really a c++ language question, but...

Loop through that row or column (or diagonal), and if any cell is 0, return
false. Otherwise, return true if the loop completes.

Implement that in c++ code, and if you have trouble, show us your attempt at
the code, let us know exactly which part is the problem, and what that
problem is (i.e., you get a compiler error, a run-time error, or simply
incorrect behavior).

-Howrd
 
V

Victor Bazarov

PyPK said:
Does anyone know of a simple implementation for detecting straight line
.So something like if we have a 2D arary of pixel elements representing
a particular Image. How can we identify lines in this Image.
for example:

ary =
{{1,1,1,1,1},
{1,1,0,0,0},
{1,0,1,0,0},
{1,0,0,1,0},
{1,0,0,0,1}}
So if 'ary' represents pxl of an image which has a horizontal line(row
0),a vertical line(col 0) and a diagonal line(diagonal of ary). then
basically I want identify any horizontal or vertical or diagonal line
anywhere in the pxl array and return true if its composed of only lines
else false...

Do you have a C++ _language_ question?

V
 
P

PyPK

was trying to understand it..is there any demo code that could
demonstrate its behaviour
 
V

Victor Bazarov

PyPK said:
was trying to understand it..is there any demo code that could
demonstrate its behaviour

There probably is. Try googling for it.

Again, any particular algorithms for doing something particular are
not really on topic here. Try a different newsgroup.

V
 
M

mlimber

PyPK said:
was trying to understand it..is there any demo code that could
demonstrate its behaviour

The key word for this concept is "edge detection". Any book on image
processing will cover it, and I'm sure you can find some code online.
If you have a C++ question, post it here. Otherwise, you should
probably post to sci.image.processing or comp.dsp.

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top