LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a BMP File by Pixel and plotting into a waveform graph

Hello,

 

I would like to plot a graph showing grey level vs radius by reading a the pixel from a BMP file.

So I have to find out what's the radius of each pixel of square from the center of the circle and find out the corresponding grey level of that same pixel. A grey level of a white pixel is 0 while a black one is 255. Each pixel is 32mm by 32mm. I'm using a 24 bit BMP file and after I find out all the radius and grey level of each pixel, I have to plot the data into a graph.

Can someone show me how to implement it.

 

Thanks:)

 

The following attachment is what I have done so far which is just the starting point of my entire program and still searching for the right answers.

Im also trying to adjust the lens to see each pixel even better.

Download All
0 Kudos
Message 1 of 17
(4,500 Views)

Hi enriquez,

 

why do you create the very same topic as a LHX? Can't you join up when working on the same homework?

 

Read the BMP, pick the line with the center point, show that line (!) on a graph. To pick the image data you should use the components cluster delivered by "Read BMP file" function...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 17
(4,478 Views)

Regarding LHX, We are actually comparing our produce output in the graph thats why we are doing it seperately:) Btw, how do I pick the line with the center point, I didnt get that part. 

 

Thanks for the help:)

0 Kudos
Message 3 of 17
(4,454 Views)

Hi enriquez,

 

the ReadBMPFile function provides you with an array of the image data. All you have to do is use IndexArray to pick one line (aka row) of data...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 17
(4,438 Views)

ok I've tried your suggestion but I can't figure out how to get to the center point which is (20,20) and calculate radius from there

Do I use IMAQ point distance or any other IMAQ calibration functions?

Download All
0 Kudos
Message 5 of 17
(4,373 Views)

Hi LHX,

 

you should know the datatypes you get from ReadBMPFile, read the context help...

check.png

- You have to know the center point. If it's just the center of the image you can calc the corresponding row/column from "Rectangle" data provided by the FileRead function.

- You have to index the correct row/column. Indexing row 0 will surely not give you the center point...

- Just using BuildArray from the image data will also not give you useful data, as said before: You have to know what kind of data you receive...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 17
(4,370 Views)

Hi,

 

We are still having difficulties till now and we havent figure out how to read from the center point. The attachment below is what we have done so far but the result is still wrong. We want the result to start from 255 and slowly go down to 0 then 255 again according to the grey level and radius of the BMP file.

 

Also, we want to read from center to right, center to bottom and center to right diagonal.

 

So what can we do to attain the results that we want and what are we doing wrong?

 

Thanks:)

Download All
0 Kudos
Message 7 of 17
(4,296 Views)

Hi Everyone,

 

Ignore the question above because I  already solved it, the part that i'm having difficulty with is reading the pixel lens diagonally starting from the center point of the lens.

 

I just urgently need a response, thank you so much!:)

Download All
0 Kudos
Message 8 of 17
(4,261 Views)

Hi enriquez,

 

you mean you have problems to index the points where the x coordinate has the same value as the y coordinate? 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 17
(4,246 Views)

What I meant is how do I manipulate the array to read from the center to the right diagonal? and how do I make another graph that shows the upside down result of the radius graph? 

0 Kudos
Message 10 of 17
(4,237 Views)