LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply bilateral filter over a 2d matrix image

Solved!
Go to solution

@gptshubham595 wrote:

Hey Rahul you can use this directly to do this using above python code and python integration toolbox via Enthought 

 


 if you don't put 
hl = int(diameter/2)
you'll get 
gi = gaussian(source[neighbour_x, neighbour_y] - source[x,y], sigma=sigma_i)
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
 
and you should add 
 gi = gaussian(x=float(source[neighbour_x, neighbour_y]) - source[x,y], sigma=sigma_i)
 
or there will be 
gi = gaussian(source[neighbour_x, neighbour_y] - source[x,y], sigma=sigma_i)
RuntimeWarning: overflow encountered in ubyte_scalars
0 Kudos
Message 11 of 26
(2,168 Views)

@gptshubham595 wrote:

.. using above python code and python integration toolbox via Enthought 

 

 

rather use the python node

 

bilateral_filter_python-node.png

Message 12 of 26
(2,157 Views)

thank you!

 

ISSUE: ERR IN READING INPUT IMG

 

I tried your code it is giving me an output image but in order to read input image it is giving error

 

gptshubham595_3-1612538880095.png

 

 

gptshubham595_4-1612538936379.png

 

 

 

 

 

but can you help regarding this error? 

 

gptshubham595_0-1612538600574.png

 

0 Kudos
Message 13 of 26
(2,139 Views)

Sorry it was error due to png file read as jpg file

 

replacing read jpg file.vi to read png file.vi  worked

 

ThankYou

0 Kudos
Message 14 of 26
(2,138 Views)

I wanted to see, if I can reduce JPG artefacts by bilateral filtering 

 

Actually, we don't need the opencv-python package to read jg or png.

 

attached is  a more polished version, in LabView 2020 x64

 

 

 

Download All
Message 15 of 26
(2,120 Views)

Is the image b&w (8bit greyscale) or RGB (24bit)?

 

I think all you need to do is a 2D convolution with a 2D Gaussian. Code should fit a postage stamp. No Python.

 

 

0 Kudos
Message 16 of 26
(2,110 Views)

@altenbach wrote:

Is the image b&w (8bit greyscale) or RGB (24bit)?

 

I think all you need to do is a 2D convolution with a 2D Gaussian.


Here's how that could look like (note that the edges need to be corrected for the truncated kernel, shown is one possible simple correction). Note that the blur scale is arbitrary and might not correspond to other libraries.

 

altenbach_0-1612691757526.png

 

 

Message 17 of 26
(2,103 Views)

the main intention is not to get a blurred image, instead, we wanted to apply a bilateral filter over the image, in order to get a clean curve and reduce noise

 

like

initially we have (good freq)>=(noise)

frequency*1000 then we have (good freq)_new >> (noise) _new

 

GKalliatakis/Bilateral-Filtering: Applying Bilateral Filtering to images (github.com)

 

 

0 Kudos
Message 18 of 26
(2,097 Views)

Sure. I am just saying that all that could be implemented in G directly. Probably not that hard.

 

Do you have an example image before and after the desired filtering?

0 Kudos
Message 19 of 26
(2,086 Views)

gptshubham595_0-1612722104122.png

 

0 Kudos
Message 20 of 26
(2,082 Views)