LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

brightest pixel per row

Solved!
Go to solution

Hello everyone,

 

I am trying to write code that gives the brightest pixel per row of an image and set that to 255, and all others to 0.  I have code that does this, but it is extremely slow(260 - 300 ms per frame!).  The way I have done it is to change it to an array and do a couple for loops with some logic....  I was hoping for some suggestions for a better way.  I have tried the threshold vi with a small range, but it will set all the pixels in the that range to white, not just the first brightest pixel.  Any ideas?

 

Thank you

 

Matt

0 Kudos
Message 1 of 11
(4,475 Views)
Solution
Accepted by topic author oglakan

Hi Matt,

 

you say you changed the data to an array. In which form is your original data?

Once you have an array (2D I guess) you could just loop through the rows and for each row use the Min/Max, multiply the array with 0 and set the pixel at the Max index to 255. See image.

 

Max to 255 

 

Hope this helps,

Daniel

 

 

 

 

 

Message Edited by dan_u on 02-17-2009 05:51 PM
Message 2 of 11
(4,465 Views)

See Attachment. Last one is quickest 

 

0 Kudos
Message 3 of 11
(4,458 Views)

@JCC: nice examples, I also thought about in place operations. But your examples don't set all other values (except for the max) to 0.

 

0 Kudos
Message 4 of 11
(4,454 Views)

You could initialize another array with all zeros and replace the appropriate elements of that with 255.  This means having space allocated for two arrays in memory, but that did not seem to be a problem since some versions probably had at least two copies anyway.

 

Lynn 

0 Kudos
Message 5 of 11
(4,439 Views)

Dan,

 

Thanks a lot!!  That was a very simple and effective way to do this.  I have to make it more complicated, but at least you got me started.  I was doing it in a far less effiecient way.  You rule!

 

Matt

Message 6 of 11
(4,387 Views)

Matt,

 

I'm glad I could help. Happy wiring!

 

Daniel

 

0 Kudos
Message 7 of 11
(4,379 Views)

This is faster!!!

 

Try this 🙂

 

 

0 Kudos
Message 8 of 11
(4,373 Views)

What is that big one?  Is that something in 8.6?  I have 8.2, so that is totally alien to me.  wish I knew.

 

Matt

0 Kudos
Message 9 of 11
(4,348 Views)
That is the In Place Element Structure.  It is a memory control feature.  It was introduced in LabVIEW 8.5
0 Kudos
Message 10 of 11
(4,334 Views)