473,394 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Pixel Manipulations

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...

Sep 28 '05 #1
6 1275

"PyPK" <su*******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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

Sep 28 '05 #2
PyPK wrote:
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
Sep 28 '05 #3
Hi:
Look up the "Hough transform"

Sep 29 '05 #4
was trying to understand it..is there any demo code that could
demonstrate its behaviour

Sep 29 '05 #5
PyPK wrote:
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
Sep 29 '05 #6
PyPK wrote:
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

Sep 29 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: grogerteal | last post by:
Hello, I am pretty new to programming and would like someone to help me get started on the program that I need to make. I hope it is not hard to do, but what I would like is a simple app that...
1
by: PyPK | last post by:
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...
10
by: unknown | last post by:
some one can give me a portable source codes that color a pixel? (env *nix) -- unknown
7
by: walter.alex | last post by:
November 16 2005 -- The recent launch of the new 5 year advertising solution from MillionPixelClick.com means the pixel advertising craze will continue unabated. Selling advertising space by the...
13
by: Martijn Mulder | last post by:
I try to define a line with the length of 1 unit (1 pixel) that is, in fact, just a point on the screen. But when I draw it with a wide pen with the appropriate StartCap and EndCap (Round), it will...
33
by: Dave (DreamIsle) | last post by:
Hello. I'm working on a layout that I need to be pixel specific. How can I get the font to stay precisely the height I need? Specifying line-height or font-size in px doesn't yield the results I...
30
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes...
8
by: ofiras | last post by:
Hi, I made a "Paint" program, but I couldn't find a method to paint 1 pixel using graphic state ("Graphics g = Graphics.FromHwnd(this.Handle);") How can I paint 1 pixel? I guess I can make a...
1
by: ofiras | last post by:
In bitmap, how can I find the nearest pixel (pixel 1) to a specific pixel (pixel 2) that has different color from pixel 2? Or how can I find a pixel in a specific distance from pixel 2 (like a...
9
by: raylopez99 | last post by:
After refering to the below thread, I take it for C# Forms 2.0, there a way to draw a 1 pixel by 1 pixel rectangle, which I was able to do just now successfully. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.