LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do you place a picture in another picture

Solved!
Go to solution

I have a picture.  A simple line drawing and I want to place it in another picture at a particular location.  I've been tinkering with the 2d picture/drawing functions but am yet to figure out how to do this.  I suspect that there is a simple way to do this, but I haven't found it yet.  In effect, I want to take picture 1 and place it in picture 2 at a particular location.

0 Kudos
Message 1 of 21
(2,062 Views)

Simply use the draw function to draw picture1 onto picture2, using picture2 as input picture.

Use Move Pen to move to the start point, then call Draw Line.

 

George Zou
0 Kudos
Message 2 of 21
(2,044 Views)

Parse and move existing picture:

https://lavag.org/topic/17138-2d-picture-translation-movement

 

George Zou
0 Kudos
Message 3 of 21
(2,014 Views)

I didn't mean a literal drawing of a line.  Just think of it as a picture of something that I need to place in another picture.

0 Kudos
Message 4 of 21
(1,959 Views)

The question isn't how to move a section of an existing picture but how to insert one 2d picture into another 2d picture at a particular location.

0 Kudos
Message 5 of 21
(1,971 Views)

If you want to put the 2nd image on top of 1st image at (0,0), you can simply use a string concatenate.  If not at (0, 0), you need to move the top image first.

 

George Zou
0 Kudos
Message 6 of 21
(1,954 Views)

 

Can you please attach your VI?

0 Kudos
Message 7 of 21
(1,948 Views)

I don't have a VI.  I don't know how to do it using the 2d drawing tools provided by LabView. I don't even know if it can be done using the 2d tools provided by LabView.  I want to place picture 2 into picture 1 at a known but arbitrary position.  I've been tinkering with the position property nodes, but I've not gotten anything to work.  I could convert the image to a 2d array of color values and use the array tools, but a 2d image is already a 2d array of color values.

Jim12345678_0-1659363520095.png

 

0 Kudos
Message 8 of 21
(1,917 Views)

Let me guess.  You have 2 picture files, like jpg/png/bmp, is that right?

 

George Zou
0 Kudos
Message 9 of 21
(1,912 Views)
Solution
Accepted by topic author Jim12345678

OK.  I couldn't find any LabView functions to do this for me; so, I had to break the images down into arrays, use the array tools and then reconstruct the images.  Build canvas can be thought of as picture 1 to which I want to add picture 2 at some position described by X and Y.  Extract the image data from the pictures as arrays.  Reshape the 1d representation of the images into the 2d representation.  In this case the, RGB values each are 1 byte; hence, each pixel is represented by three array values (the array width is 3x the number of pixels).  Use the insert into array function to place picture 2 into picture 1, then reshape the 2d array back to a 1d array, replace the data in picture 1 with the just created 1d array and rebuild the image.  You do need to be careful that the picture 2 falls completely within picture 1 or you will need to adjust the bounds of the resulting picture.

 

Jim12345678_0-1659376642648.png

 

0 Kudos
Message 10 of 21
(1,898 Views)