03-17-2015 06:33 AM
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.
Solved! Go to Solution.
03-17-2015 07:25 AM - edited 03-17-2015 07:28 AM
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
03-17-2015 09:31 AM
thank you for your help. i will test and write result here.
03-17-2015 10:38 AM
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.
03-17-2015 01:33 PM - edited 03-17-2015 01:33 PM
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?
03-17-2015 01:57 PM
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.
03-17-2015 02:04 PM - edited 03-17-2015 02:13 PM
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.
03-17-2015 02:22 PM
thank you for your help. i will work on it and write result here.
03-18-2015 02:07 AM - edited 03-18-2015 02:25 AM
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?
03-18-2015 03:27 AM
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.