LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Crop Pixmap

I'm struggling to see how I can crop an image (pixmap).
 
Say I have an image that is 500x1000px and I only ever want to work with a pixmap that is 500x500px in size. How can I create a pixmap so that the image is effectively cropped?
 
"Draw Unflattened Pixmap" has an input for the top left of the pixmap, however this value only shifts (increases) the origin, and does not allow me to change the portion of the image that is returned.
 
Can any picture control gurus lend a hand? Thanks
0 Kudos
Message 1 of 5
(2,992 Views)
You could use "Get Image Subset.vi" in the image submenu, if you really have
a pixmap (see last remark).

If you want to avoid getting the large image in the first place, it's a bit
more difficult. First we have to know how you get the image (from loading a
file, from a picture control, from a property node, or drawn directly in an
array).

If you load it from file, or get it from a property node, there is not much
you can do.

If you draw it directly in an array (probably not, since it's kinda
obscure), then simply limit the array size.

If you get it from a picture control, you can simply use the Picture to
Pixmap function to get the desired pixmap.

If you want to use Draw Unflattened Pixmap (then you don't have a pixmap,
you have an unflattened pixmap, or a simple 2D array 😉 , use the Array
Subset function (in the Array palette).

Regards,

Wiebe.


0 Kudos
Message 2 of 5
(2,983 Views)

how to crop an image ?can you please help me

0 Kudos
Message 3 of 5
(2,557 Views)

Hi dfsfdsfv, 

 

My name is Kevin, I am an application engineer at NIUK. In answer to your question how do you crop an image, Using the Picture Functions, this can easily be accomplished in LabVIEW. Using the Graphic Format VIs, first choose the format of the graphic you would like to read. (ie. JPEG, BMP, PNG) Once the file has been read, use the Unflatten Pixmap.vi to create a 2-D array of data that represents each pixel of the picture. Now use the Array Subset function to extract the data that you would like to crop from the original picture. This data can then be input into the Flatten Pixmap.vi and then either saved to a file, drawn on the front panel, or both.

 

Kind Regards

 

Kevin R
Applications Engineer
National Instruments UK&Ireland
0 Kudos
Message 4 of 5
(2,545 Views)

Hi,

 

If you can convert the pixmap to image then this can be done with the IMAQ Extract function

---
Silver_Shaper | CLD
Message 5 of 5
(2,538 Views)