07-28-2022 01:42 PM
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.
Solved! Go to Solution.
07-28-2022 03:10 PM
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.
07-28-2022 05:44 PM - edited 07-28-2022 05:46 PM
Parse and move existing picture:
https://lavag.org/topic/17138-2d-picture-translation-movement
07-29-2022 03:14 PM
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.
07-29-2022 03:20 PM
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.
07-29-2022 06:57 PM
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.
07-29-2022 09:06 PM
Can you please attach your VI?
08-01-2022 09:24 AM
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.
08-01-2022 10:07 AM
Let me guess. You have 2 picture files, like jpg/png/bmp, is that right?
08-01-2022 01:06 PM
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.