LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using 2D Interpolate vi on a jpg

Solved!
Go to solution
Highlighted

So I have a jpg that I converted and downsized to a 2D array. I want to be able to use the bilinear interpolation method on the array and see the difference using an intensity chart. However, I am having a hard time understanding the inputs/outputs of the Interpolate 2D vi provided (https://zone.ni.com/reference/en-XX/help/371361R-01/gmath/interpolate_2d/).

 

for what think the connections should be:

 

X = the input array that I have

Y = the value that I want to interpolate by

Z = the new value created from the X and Y

 

Z being connected to an intensity graph to show the new array.

 

 

One issue is, I want X to be a control but it needs to be a 2D. I understand how to do bilinear interpolation by hand but with a pretty hefty array I am kind of stuck. 

I've tried to look deeper inside the VI's created inside of VI's to try to better understand but it gets more complex everytime. Still very new to Labview, any help would be appreciated. 

0 Kudos
Message 1 of 12
(319 Views)
Highlighted

Images are typically integer, while interpolations works better on floating point values. What is the image type (RGB, 8bit grayscale, etc.)

 

You probably need an intensity graph. An intensity chart is not really suitable. (do you know the difference?)

 


@TheNameIsBailey wrote:

for what think the connections should be:

 

X = the input array that I have

Y = the value that I want to interpolate by

Z = the new value created from the X and Y

 

Z being connected to an intensity graph to show the new array.


That makes no sense, both x and y are independent variables. Can you attach a small example VI with typical data. What kind of "difference" are you expecting to see.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 2 of 12
(285 Views)
Highlighted

@altenbach wrote:

Images are typically integer, while interpolations works better on floating point values. What is the image type (RGB, 8bit grayscale, etc.)

 

You probably need an intensity graph. An intensity chart is not really suitable. (do you know the difference?)

 


@TheNameIsBailey wrote:

for what think the connections should be:

 

X = the input array that I have

Y = the value that I want to interpolate by

Z = the new value created from the X and Y

 

Z being connected to an intensity graph to show the new array.


That makes no sense, both x and y are independent variables. Can you attach a small example VI with typical data. What kind of "difference" are you expecting to see.


Yes I definitely meant graph and not chart. Current image I am using is a 1200x630 JPG file, I'll attach. I will want to be able to test on other JPG's later though. Difference wise as in how the image is constructed once interpolated. I want to eventually be able to use all methods provided (bilinear, bicubic, nearest) to be able to view how the image looks after.

 

The VI is a functional VI whatsoever but I hope it helps clear up what I am trying to say. 

 

Edit: Forgot to add, I have another VI that turns the jpg into an array and then goes through the array through and shortens the array using an iterator, so we'll have a more pixelized image. 

Download All
0 Kudos
Message 3 of 12
(246 Views)
Highlighted

Have a look at this thread, for example (Also see posts above and below).

 

(I'll have a look at your attachments later ....)


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 12
(252 Views)
Highlighted

@TheNameIsBailey wrote:
I attached a VI to help explain my thought process but it definitely does not work. The input array represents the input image. For now, the image I am working with is that fire.jpg. However, I eventually want to be able to test different images. I am also focusing on bilinear currently but do plan on doing all methods provided (bicubic, nearest, ...). 

 


Your attached code does not explain any obvious thought process to me. 😉

 

  • What is the "Interpolate by:" slide control supposed to control?
  • Many of your wires don't have a data source
  • You are not using any of the interpolation outputs
  • The interpolation is missing many inputs

 

So you have an input image in color. What kind of output do you want from it after interpolation?

 

  • A new image that has more or fewer pixels?
  • The interpolated color value at a fractional pixel location
  • The color profile along an arbitrary line?
  • Something else?

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 5 of 12
(249 Views)
Highlighted

@altenbach wrote:

@TheNameIsBailey wrote:
I attached a VI to help explain my thought process but it definitely does not work. The input array represents the input image. For now, the image I am working with is that fire.jpg. However, I eventually want to be able to test different images. I am also focusing on bilinear currently but do plan on doing all methods provided (bicubic, nearest, ...). 

 


Your attached code does not explain any obvious thought process to me. 😉

 

  • What is the "Interpolate by:" slide control supposed to control?
  • Many of your wires don't have a data source
  • You are not using any of the interpolation outputs
  • The interpolation is missing many inputs

 

So you have an input image in color. What kind of output do you want from it after interpolation?

 

  • A new image that has more or fewer pixels?
  • The interpolated color value at a fractional pixel location
  • The color profile along an arbitrary line?
  • Something else?

 


Okay then here's what I know.

https://www.youtube.com/watch?v=q4-FJeWcidE  @8:25 there is an example going over how to do bilinear interpolation (because that is what i'm currently wanting to do). In this example, they have 3 variables. (%Ethyl, Celcius, Values) with %Ethyl and Celcius being the independents and Values being the dependent. The variables that I have are my input jpg array, a control of setting the value to interpolate by, and an array with the new points created. 

 

For the output however, I just want to see how the picture changes with the new array of point values. 

 

My whole issue is that I am having a hard time understanding where my inputs/output should go and for my control to be able to be used as a control. 

0 Kudos
Message 6 of 12
(228 Views)
Highlighted
Solution
Accepted by topic author TheNameIsBailey

Did you look at my thread mentioned here?

 

Your image array is on an integer grid where the array indices are X and Y. A single bilinear interpolation will give the Z value at any non-integer X,Y pixel location. To create a new picture, you need to repeat the process for a 2D array of new grid points that may or may not overlap with the original grid points.

 

My example in the linked location will do exactly that. You still need to understand what interpolation for a color picture means. As I said, the RGB components are all integers in the range of 0...255.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 7 of 12
(205 Views)
Highlighted

Oh okay for the RGB values, I was definitely overthinking that (reason why it took so long to respond, I was reading). Yes sorry, the z values on the intensity graph should definitely be 0-255, I forgot to change that. 

 

I still am however having some issues with using your provided VI. I cannot get it to display for some reason, I feel it's with not having a while loop in place, but it could be something else that I am unaware of. The sub vi is the image I have going in. The sub vi does indeed work and outputs the array of the image.

0 Kudos
Message 8 of 12
(163 Views)
Highlighted

@TheNameIsBailey wrote:

 

I still am however having some issues with using your provided VI. I cannot get it to display for some reason, I feel it's with not having a while loop in place, but it could be something else that I am unaware of. The sub vi is the image I have going in. The sub vi does indeed work and outputs the array of the image.


OK, you need to do a few tutorial first. This has nothing to do with my "provided VI" Where is the subVI? Where is the image data?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 9 of 12
(134 Views)
Highlighted

To convert your 24bit image to an 8 bit paletted image matching the color ramp of your intensity graphs, you need to map the 24bit colors accordingly. Try to do that first.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 10 of 12
(131 Views)