01-21-2021 11:38 AM
I've been doing C and javascript lately where curly braces for code blocks and semicolons for end of command rule the day.
Knowing how hard it is to get indentation right on code editors, I'd be scared that code will suddenly change.
But having an environment where appearance on screen and code structure are linked seems like a good idea.
01-21-2021 01:32 PM
Wp = 0 i = 0 while i < 5: j = 0 while j < 5: w = i * j Wp = Wp+w j += 1 i += 1
i_f= 10 + Wp
I want to add and store values and use them outside the loop.
01-21-2021 01:42 PM
Seems like your garden variety nested For Loop problem. Where are you stuck?
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
01-21-2021 01:49 PM - edited 01-21-2021 01:50 PM
My main intention is this PYTHON CODE
Re: How to apply bilateral filter - NI Community
def apply_bilateral_filter(source, filtered_image, x, y, diameter, sigma_i, sigma_s): hl = diameter/2 i_filtered = 0 Wp = 0 i = 0 while i < diameter: j = 0 while j < diameter: neighbour_x = x - (hl - i) neighbour_y = y - (hl - j) if neighbour_x >= 360: neighbour_x -= 360 if neighbour_y >= 360: neighbour_y -= 360 gi = gaussian(source[neighbour_x][neighbour_y] - source[x][y], sigma_i) gs = gaussian(distance(neighbour_x, neighbour_y, x, y), sigma_s) w = gi * gs i_filtered += source[neighbour_x][neighbour_y] * w Wp += w // *************STUCK AT HERE**********/// j += 1 i += 1 i_filtered = i_filtered / Wp filtered_image[x][y] = int(round(i_filtered))
01-21-2021 02:15 PM
Well, that code is quite "spaghettified" but somewhere or another, you're going to need a shift register to keep track of i_filtered. You'll only need two loops also, not four. This is the solution to your original post, see if it gives you some ideas.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
01-21-2021 02:30 PM
If you are not familiar with loops and shift registers, I would recommend you learn more about LabVIEW from here. How to Learn LV