LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Resize a picture

Okay searching around I found that I could use MASK to mask out the white after the resize and end up with a transparent image still. See attachment.

- A minute saved is a Minute earned!
0 Kudos
Message 11 of 30
(4,541 Views)

Okay for some reason i could get it to work for one image but not the next...I guess white isn't always the transparency after the resize function completes. Anyone understand how the MASK layer in labview works? It is a single 1D array. I searched but have not found anything yet...Maybe i can make the transparency color something i dont need like bright pink (i've seen in game sprite designs) then have the MASK feature use that color?

 

Any better ideas? MASK information break down.

 

For information on what im doing. Trying to draw images on top of a background image (2d game style) with transparency Just seeing what i can do with labview as a 2D game engine. you know, because i can.

- A minute saved is a Minute earned!
0 Kudos
Message 12 of 30
(4,525 Views)

http://forums.ni.com/t5/LabVIEW/how-to-get-alpha-images-on-picture-box/td-p/1137332

 

Found my answer there.

 

I guess for a 24bit image the MASK labview pads data to keep it 16bit's even. so when i first tried to create a 2D mask on a 24bit image to resize i failed do to padding for a 32bit image. With this is mind i used "image to alpha" from link and then ran through the same style resize to get a new alpha and then from what i found in the example i used greater then on the array and ran it through labview's "bit array to byte arrary" for a new MASK

 

The link did show more on the full ALPHA drawing which i may return to and look through. Thanks to Darin K.

 

Still not sure about the 32bit image...does labview support 32bit images? All you can pull from the picture libray is 24, 8, 4 and 1 bit images?

 

- A minute saved is a Minute earned!
0 Kudos
Message 13 of 30
(4,522 Views)

Hi

 

I saw comments that posted earlier which give a good Resize function on the 2D Array Resizing.

 

But I got a concern, the Resize 2D Array Function remove or skip one of the columns/row in order to have the resized columns/rows.

 

So what if the rows and/or columns has some representation to that image, how are we going to eliminate the columns or rows, without have breaks in between in the images?

 

Example:

 

A circle in 2D Array in the form of 0 and 1.

 

1 1 1 1 0 0 0 1 1 1 1

1 1 0 0 1 1 1 0 0 1 1 

1 0 0 1 1 1 1 1 0 0 1

0 1 1 1 1 1 1 1 1 1 0

0 1 1 1 1 1 1 1 1 1 0

0 1 1 1 1 1 1 1 1 1 0

1 0 0 1 1 1 1 1 0 0 1

1 1 0 0 1 1 1 0 0 1 1  

1 1 1 1 0 0 0 1 1 1 1 

 

but if i use the Resize Array, might have

 

1 1 1 1 0 0 1 1 1

1 1 0 0 1 1 0 1 1 

0 1 1 1 1 1 1 1 0

0 1 1 1 1 1 1 1 0

0 1 1 1 1 1 1 1 0

1 0 0 1 1 1 1 0 1

1 1 1 1 0 0 1 1 1

 

as u can see the after using Resize Array, the continunity of the drawing of the circle in 0s is broken/discontinuous.

 

So anyhow can help to give a suggestion on how to remain the continunity of the drawing while the resize is still valid?

0 Kudos
Message 14 of 30
(3,650 Views)

You can read up on 2D interpolation methods, like bilinear interpolation, and there should probably even be some examples here, but I'm not sure how well such algorithms deal with binary values, as I expect at least some of them want to create different types of averages for the final values.


___________________
Try to take over the world!
0 Kudos
Message 15 of 30
(3,595 Views)

Going back to resize.vi created by tst, how can we convert the array picture to imaq type image? What I'm doing is resizing an image first before applying vision tools for measurements.

0 Kudos
Message 16 of 30
(3,292 Views)

I don't really have experience with the vision toolkit, but I believe it does have conversion VIs (probably "array to image" or something similar). Look through its VIs.

 

Also, I expect that the vision toolkit probably has its own resizing VIs and you don't need to go through my fairly primitive implementation.

 

And even if you do, there are better implementations, even in this thread (and you can also find some calling .NET functions).


___________________
Try to take over the world!
0 Kudos
Message 17 of 30
(3,270 Views)

Hi,

I'm using your work to resize a preview of labels to print.

I have a shift in the colors ina 8-bit bmp image.

All is very dark, in black, blue and grey, blue also the background that originally was white?

What I'm doing wrong?

Thanks for everything

0 Kudos
Message 18 of 30
(1,484 Views)

This thread is almost 18 years old by this point and has more than one solution, so it's not clear what you are referring to. I would suggest doing the following:

 

  1. Post the code you're actually using. Backsave it to an older version of LV so people can open it. Set the values in the front panel to be the default values so that people can also see what you're seeing.
  2. Post the BMP you're using.
  3. Post an image of what you're actually seeing. Try to include the actual numeric values of the pixels before and after the resizing.

 

My guess would be this: since the BMP is 8 bit, that would means there would have to be a lookup table to translate the pixel byte values to colors. If the resizing code doesn't take this into account (and assumes, for example, there are 4 bytes per pixel), that could cause it to take the wrong colors.


___________________
Try to take over the world!
0 Kudos
Message 19 of 30
(1,462 Views)

@PincoG wrote:

Hi,

I'm using your work to resize a preview of labels to print.

I have a shift in the colors ina 8-bit bmp image.

All is very dark, in black, blue and grey, blue also the background that originally was white?

What I'm doing wrong?

Thanks for everything


Sounds like you are not using the color table of the bmp image.

 

 

George Zou
0 Kudos
Message 20 of 30
(1,449 Views)