LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to do horizontal & verticle projection ?

hello, i am trying to find the method of horizontal and verticle projection in labview for character detection.is there any way to do this?

0 Kudos
Message 1 of 7
(4,718 Views)

What do you mean?  If what you want to do is sum along the X axis of an image, or sum along the Y axis of an image, this is (almost) trivial.  Simply extract the Image to a 2D array of pixels and have at it (I'm assuming you know how to sum along one dimension of a 2D array).

 

Bob Schor

0 Kudos
Message 2 of 7
(4,668 Views)

sir,horizontal projection means sum of all white values in all row and verticle means sum of all white piels in coloumn.so mathamatically how it is possible?i am not aware of what u r saying.please explain sir.

0 Kudos
Message 3 of 7
(4,662 Views)

@sagar1511 wrote:

sir,horizontal projection means sum of all white values in all row and verticle means sum of all white piels in coloumn.so mathamatically how it is possible?i am not aware of what u r saying.please explain sir.


Who is "sir"?

 

I'm going to try to explain, but your question also has me a little confused.  First, do you know anything about Images, such as how they are represented in a computer?  You talk about "all white values in all row" -- what does this mean?  What are "white values"?  Are they pixels whose value is the color White (usually represented by 255 if a Grey Scale (U8) image, or RGB values of 255 on each channel if color)?

 

So here is Image 101.  An "Image" can be considered a rectangular array of "Pixels", where a Pixel is something that codes "Shades of Grey" or "Color" according to some format (I just hinted at the format in the previous paragraph).  When you acquire an Image (either by taking a picture with a digital camera or by reading an "Image File", such as a .JPEG or .PNG file), the data are transformed and saved in what LabVIEW calls an "Image", which is really a pointer to an area of memory where the data are kept and organized (this is why you need to do an IMAQ Create before doing any Image Processing -- you are creating and defining an Image Buffer).

 

One common thing to do with an Image is to wire it to an Image Control (otherwise known as a Display) -- when you do this, you can "see" the Image, which will be in color or in shades of Grey, depending on the Image.  Another thing you can do is to get your hands on the data contained within the Image, i.e. extract the 2D array of "Pixels".  As noted in the previous paragraph, the format of a Pixel will vary, depending on whether the Image is shades-of-grey or color.

 

Do you know what an Array is in LabVIEW (or in math, or in any other Programming Language)?  We can think of a 2D Array as a series of "things" (let's call them Pixels) arranged in rows and columns.  When we operate on rows and columns of an Array, it is sometimes convenient to think of them as "nested" 1D arrays.  For example, a 2D array with 480 rows and 640 columns could be consider a 480-element 1D Array of (1D Array of 640 Pixels)), that is, we focus on the rows, and say "Each row has 640 Pixels that we can manipulate".  Suppose the manipulation was "Sum the values of all the Pixels".  That's potentially easy to do, right?  Then you'd have an array of 480 "rows" whose elements would be the summed-Pixel-value of all of the columns.

 

What would this mean?  Not a lot.  You now have to take a step back, and think about what a Pixel represents, namely an intensity of light.  Let's simplify a lot, and consider a 16 by 16 Pixel array of U8 Grey scale images.  Let us further make the images a Pixel Checkerboard -- every other Pixel in each dimension is either Black (0) or White (255).  So summing along either dimension, any row or column, will sum 8 Black Pixels and 8 White ones.

 

What do you want such an operation to produce?  If you are talking "Shades of Grey", Black + White = Grey (probably 128), and it doesn't matter how many Blacks and Whites are involved, combining them in equal numbers gives Grey.  What mathematical operation does this suggest to you?  [Hint -- it is not addition, as 0 + 255 + 0 + 255 + 0 + 255 + 0 + 255 = 1020, which is much too big to fit into a U8).

 

So.  You have your Image on a Wire.  There is a function, appropriately on the Pixel Manipulation sub-Palette, called "Image to Array".  Now you have a 2D array of Pixels.  Do something (intelligent) with them.

 

Is any of the above not clear?

 

Bob (not "sir") Schor

 

P.S. -- try to take us seriously.  Use English, rather than "cute" abbreviations.  We are respecting you by taking time to explain things as clearly as we can, so no more "what u r saying".

0 Kudos
Message 4 of 7
(4,643 Views)

Aha, an Insight.  You are the same person who was posting about trying to isolate a license plate from an image of a car, and who used complicated Image Analysis to get the License Plate isolated, but didn't understand ROIs or Masks.

 

I'm guessing you want to turn the License Plate into a Mask.  I'm guessing that your License Plate image is mostly all Black except where it is not.  Let's assume that you want to turn it into a Mask, so you can use Hatef's idea of Masking your Car Image.  Here's one way to do this:

  • Start by getting the 2D array of Pixels corresponding to the License Plate.
  • It doesn't matter if we work by Rows, or by Columns, so let's (arbitrarily) work by rows.
  • Process each row.  If it is all 0, leave it alone, as it represents the region we do not want.
  • Now we need to worry about rows that are not all 0.  Start from the left, find the first non-zero Pixel.  Call this Left.  Start from the right, work backwards down the row to find the first non-zero Pixel.  Call this Right.
  • Left and Right represent the first and last Pixel in the row with non-zero Values (probably 255).  Set all of the Pixels between Left and Right to 255 (I'm assuming we're building an 8-bit Mask here).
  • When you've done all of the rows, convert the Array back to an Image, which will be your Mask.

You should see that what the above Algorithm does is set all of the "interior" Pixels, whatever their value, to White (255).  Now you have your Mask.

 

Bob Schor

0 Kudos
Message 5 of 7
(4,633 Views)

thank u,bob i undesrtand about arrays and how to convert image to array(2D).but i cannot understand your last two paragraph of your post.after getting array what i have to do to get horizontal projection histogram?.i also read your latest last post..i got the idea for the same.

0 Kudos
Message 6 of 7
(4,622 Views)

This is a LabVIEW Forum.  LabVIEW is about LabVIEW code.  Why don't you try to develop some code based on what I wrote (maybe start with reading in your License Image, converting it to an Array of Pixels, then trying to process something somehow.  It sounds like this is where you are getting stuck, but since u still cannot rite in gud English, I am not sure what it is that you don't understand.  However, LabVIEW code will show me what you do and what you do not understand.

 

Be sure to attach a VI.  It would also help to attach the "Test Image" you are using.

 

Bob Schor

0 Kudos
Message 7 of 7
(4,590 Views)