Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

masking problem

Hi NI community 

 

I am facing problem with changing values of mask.

My prgram is as follows

1) Converting image into binary

2) Choose ROI over image 

3) Count number ones in ROI 

 

When I am choosing larger ROI it is showing less pixels than small ROI . I have attached my problem picture, see there when I chose large ROI values I am getting smaller values wrt to smaller ROI.

 

I will appreciate your help 

Download All
0 Kudos
Message 1 of 4
(5,079 Views)

Hello,

 

please put a probe/indicator right after the summation (and before the addition). What are the values for both cases?

 

Why do you add the local variable "Total pixels" to your calculations? Also, why do you have so many local variables in general. You will get into troubles with that...

 

Your calculations are way off. Just by looking at the number of calculated pixels (3 million pixels) and your image size is 512x512 (262144 pixels, so if all are 1, the sum is equal to this), you can see that something is not ok.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 2 of 4
(5,053 Views)

Thank you for your reply.

 

Here I am reading volume of 512*512*512 binary matrix that why count is very high . I am taking ROI over these each binary image and counting number of ones, as we sum up all ones so we will get number of pixel.

It is calculating proper for samll ROI, but when I choose large ROI it shows less count than small ROI . Is there any modification IMAQ mask do with image.

 

Actually this is part of program, my main program constitite 4 to 5 tabs and many frames and for loop. In such condition it is difficult for me use wire for connection.  

0 Kudos
Message 3 of 4
(5,027 Views)

Hello,

 

I think I see what your problem is. Try casting your array to double before you sum the elements.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 4 of 4
(4,988 Views)