Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how to calculate gray level of consecutive pixels

1) Could you tell us how to calculate the matrix of gray level of consecutive pixels in some direction.
We attached file of step of calculation in Gray_Level_Co.rtf already.
please kindly determine for us.
 
2) we attached also the file of code for calculate gray level at 0 degree and 90 degree (This we got from NI Singapore).
We cannot modified for 45 degree and 135 degree.
could you tell us how to do to obtain the value for 45 degree and 135 degree.
 
Thank you very much.
 
Download All
0 Kudos
Message 1 of 15
(5,404 Views)
Hi panmanas,

After thinking about your problem for a while, it seemed like the best thing to do is to basically "rotate" and rearrange the array so that you can analyze just like if it were a 0-degree array. This way you can put it into the same For Loops you already have in your code. The output array uses -1 values to pad out short rows.

For example, the 4x4 array in your attached .rtf file would produce an output like this is in my program when rotated 45 degrees:
Original:

 0  0  3  1
 0  1  1  1
 2  2  3  3
 2  2  3  1


After 45-degree manipulation:

 0 -1 -1 -1
 0  0 -1 -1
 2  1  3 -1
 2  2  1  1
 2  3  1 -1
 3  3 -1 -1
 1 -1 -1 -1

And then you can feed it through the 0-degree loop and it should detect everything fine. You might need to tell it to throw out -1 results, but I think your code is already doing that. You may also need to make some changes to have it adjust to a larger number of rows of input data.

For 135-degree analysis, all my code does differently is reverse each row of the array individually - after that, all steps are the same as for 45-degrees. I have attached a screenshot of my code which performs these array manipulations
0 Kudos
Message 2 of 15
(5,375 Views)
Dear Vijay S.
Thank you very much indeed for your reply.
It helps us a lot.
We shall study your suggestion and apply to our work.
Thank you very much again.
 
With Best regards,
 
Panmanas
 
0 Kudos
Message 3 of 15
(5,367 Views)

Dear Vijay S.

We have tried to use your solution to calculate for 45 and 135 degree but the messgae show that - cannot running-.

Please kindly teach us how to do again. Our LABVIEW version LABVIEW 8.0

Thank you very much again.

With my best regards,

Panmanas

0 Kudos
Message 4 of 15
(5,075 Views)
Hi panmanas,
I'm afraid I don't understand what's going wrong when you try to do what I've posted. The code I posted the large screenshot of should work just fine and turn your 45 or 135-degree source into an array that can be counted as if it were under 0 degrees of rotation. And it should work in any version of LabVIEW from at least 7.0 and later. Where are you having problems running it?
0 Kudos
Message 5 of 15
(5,040 Views)

Dear Vijay S.

I shall carefully study what you taught again. May be something wrong at my side.

Thank you very much again.

With my best regards,

Panmanas

0 Kudos
Message 6 of 15
(5,033 Views)

Dear Vijay S.

We studied your solution for us and we could not run as we have attached the file for you to determine. The error messgae showed that there was diffent diment in the array connected but we could not correct.

Please kindly determine and suggest us how to do.

Thank you very much indeed.

With my best regards,

Panmanas

0 Kudos
Message 7 of 15
(4,965 Views)
To fix the broken wire, right click on the BuildArray function to the right of the broken wire and select Concatenate Inputs.
You also need to populate the enum with 45 and 135 degree selection and clean up the titles in the case statement frames to match them.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 8 of 15
(4,958 Views)

Dear AnalogKid

Thank you very much for your help.

We shall try to fix it.

But one more question, we cannot understand the function of ENUM.

Could you please kindly teach us about that?

Thank you very much.

With my best regards,

Panmanas

0 Kudos
Message 9 of 15
(4,945 Views)
 

Hi panmanas,
An enum, or Enumerated Type control, is a way of having numbers (0 through N) associated with a fixed set of labels. They can act to somewhat restrict inputs to VIs and can also make it easier for users to choose values using labels that are human readable instead of numbers which may not be obvious as to their function (Such as "Up", "Green", etc. rather than 0, 1, 4).

You can find more info on enums in the LabVIEW help. Also see KnowledgeBase 3IMH7QPH: What is the Difference Between a Text Ring and an Enum?.

 
0 Kudos
Message 10 of 15
(4,937 Views)