02-12-2014 09:15 PM
Hi guys
I am trying to perform zero padding.I am having 512 by 512 array and I want to add 256 rows of zeros above and below of my array so as my new array will be 1024 by 512,where 1st & last 256 rows are zeros .I tried to use zeropadd subvi but it can perform on 1d array only.I will appreciate your help
Parag
Solved! Go to Solution.
02-12-2014 09:24 PM - edited 02-12-2014 09:24 PM
Hi parag77,
I think Build Array function will do the trick. Select Concantenate Inputs to append 2D arrays.
http://zone.ni.com/reference/en-XX/help/371361K-01/glang/build_array/
Ee Lim
02-12-2014 09:25 PM
Hi parag77,
Presuming that you are building a 2D array. Have your tried creating that array of zeroes using Initailize array (http://zone.ni.com/reference/en-XX/help/371361J-01/glang/initialize_array/)? You can use that to build an array of zeros. You can merge the top and the bottom and top of the 512 by 512 array by using Build Array (http://zone.ni.com/reference/en-XX/help/371361J-01/glang/build_array/).
Give it a try and let me know how it goes.
PS: Please do attach a VI of what you have done so far next time
Warmest regards,
Lennard.C
02-12-2014 09:26 PM
Hello parag77
Have you tried using the "Initialize Array" node and the "Build Array" node together ????
See attached image.
Note the build array has to be set to concatenate
02-12-2014 09:37 PM
Derick Mathew
Thank you for your suggestion
I tried to used the same as you post but the appended or build matrix is 3d not 2d .
Thank you
Parag
02-12-2014 09:40 PM
You can expand the Initialize Array as Per your Requirements 🙂
02-12-2014 09:41 PM
Hi parag77,
How about you use initialize array to build the 1024 by 512 array of zeroes and then replace the middle with your 512 by 512 array using Replace Array Subset (http://zone.ni.com/reference/en-XX/help/371361H-01/glang/replace_array_subset/)? Or you could to build 512 by 512 array of zeroes and put your desired array in between using Insert into Array (http://zone.ni.com/reference/en-XX/help/371361J-01/glang/insert_into_array/).
Warmest regards,
Lennard.C
02-12-2014 09:46 PM
Did you modify the build Array node to concatenate inputs ???? that should help
02-12-2014 09:46 PM
Thank you Lennard
PFA my VI .I tried to do as per link send by you but when I concatenating the array the new array formed is 3d but I want 2d for filteration .
Thank you
Parag
02-12-2014 09:47 PM
check image to see what i mean