LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to tell me how i can make program in labview that take pixels of black and withe image and give coordinate of black or white pixels back to me.

Solved!
Go to solution

hello everybody

is it possible to tell me how i can make program in labview that take pixels of black and withe image and give coordinate of black or white pixels back to me.

0 Kudos
Message 1 of 12
(3,475 Views)
Solution
Accepted by topic author amkamyab

It depends on the image and the LabVIEW module that you have installed. Labview can open bitmap and png files and convert them into arrays: if it is really a monochromatic (1bit depth) you get a 2-D array of boolean, T for white, F for black. You only have to look at the element index to know its coordinates (remember that LabVIEW doesn't use the common order of rows and columns, so you have to transpose and reflect the array). If you have a 24bit bitmap, the array will contain the colours in hexadecimal rappresentation (000000 for black, FFFFFF for white and so on); again, you only need to check if the element of the array match your conditions and get its indexes.

With the vision module you con open other images and perform advanced operation on them without converting them into arrays. Anyway, you can just type your image extension into the LabVIEW help and look at what you get.

Here a snippet to open a monchromatic bitmap

 

open bitmap monochrome.png

Message 2 of 12
(3,461 Views)

thank you for your help. i will test and write result here.

 

0 Kudos
Message 3 of 12
(3,437 Views)
Solution
Accepted by topic author amkamyab

it is good. i could enter 1bit image in and show it in array. now i want to take pixels coordinates. i meen i want to have (x,y) of each pixel to send it pixel coordinate to another program i wrote for steppers motor.

0 Kudos
Message 4 of 12
(3,423 Views)
Solution
Accepted by topic author amkamyab

Here's a slightly simpler version.

 

 

 

(Depending how you want to process the output, you might not need to traspose and/or reverse. Boolean to 0,1 works directly on the 2D array if needed ;))

 


@amkamyab wrote:

it is good. i could enter 1bit image in and show it in array. now i want to take pixels coordinates. i meen i want to have (x,y) of each pixel to send it pixel coordinate to another program i wrote for steppers motor.


Can you be a bit more specific on how the output is supposed to look like? Initially you wrote "black or white", and since all pixels are either black or white, do you want to send all pixels? In what format? In what order? Please clarify?

Message 5 of 12
(3,402 Views)
Solution
Accepted by topic author amkamyab

Thanks for your attention to my problem.

Exactly I want to use 1 bit image that contain black ( 0 ) and white ( 255 ) and read coordinate of each pixel in image and give this coordinates with control of Black or white to two stepper motor ( the program for moving stepper motor I wrote in lab view ) to make XY moving on plane and join this program to laser for action on white point ( 255 ) pixels and no action on black ( 0 ) pixels.

0 Kudos
Message 6 of 12
(3,388 Views)
Solution
Accepted by topic author amkamyab

OK, since you can write these points in any order, you don't need to transpose or reverse. Easiest would be to reshape to a 1D array and process them in memory order directly using an autoindexing FOR loop.

Message 7 of 12
(3,382 Views)
Solution
Accepted by topic author amkamyab

thank you for your help. i will work on it and write result here.

0 Kudos
Message 8 of 12
(3,366 Views)
Solution
Accepted by topic author amkamyab

I didn't thought of the boolean to 0-1; your way is a lot better.


altenbach ha scritto:

Easiest would be to reshape to a 1D array and process them in memory order directly using an autoindexing FOR loop.


I'd rather use two nested for loop: this way you can use the two indexes to control the step motors; what are the advantages of using a single one?

open bitmap monochrome.png

Message 9 of 12
(3,342 Views)
Solution
Accepted by topic author amkamyab

i put here an example picture.

I want start from left top side of image and read pixels. When arrive to black pixels laser must act and when I arrive to white pixels no act for laser. So I must read every Colum and when one Colum finish go to other Colum and so on till end.

0 Kudos
Message 10 of 12
(3,329 Views)