LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to shift elements in an array up or down without changing its size?

Our project is comparing images, so in order to compare them properly, we covert the images to arrays with the same size and align them. Our problem is the alignment of the elements in the arrays, so we need to shift the elements to properly compare the pixels from both images. In order to align them, we created a mark in the image, and the mark is supposed to be in the same position as the mark of the reference image. How can we do this? We are trying to shift the elements from an array with respect to a mark without adjusting its size. Please do help us. Thank you.

0 Kudos
Message 1 of 41
(5,997 Views)

Would Rotate 1D Array do it for you?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 41
(5,991 Views)

How can I use it to shift 2d arrays up, down, left and right? Sorry but I'm kinda new here. Thank you.

0 Kudos
Message 3 of 41
(5,943 Views)

@pinkman wrote:

Our project is comparing images, so in order to compare them properly, [..] In order to align them, we created a mark in the image, and the mark is supposed to be in the same position as the mark of the reference image. [..]



This sounds more like a feature called "Region Of Interest" (ROI) of the Vision Development Module.

So instead of investing weeks or month to develop your own image manipulation software, you can get a solution with less effort and expenses.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 41
(5,940 Views)

@pinkman wrote:

Our project is comparing images, so in order to compare them properly, we covert the images to arrays with the same size and align them. Our problem is the alignment of the elements in the arrays, so we need to shift the elements to properly compare the pixels from both images. In order to align them, we created a mark in the image, and the mark is supposed to be in the same position as the mark of the reference image. How can we do this? We are trying to shift the elements from an array with respect to a mark without adjusting its size. Please do help us. Thank you.


Another way of matching template "feature" images is to use classic 2D correlation and then find the coordinates of the highest correlation. Not sure though it is what you are trying to do?

 

Here are some example code showing that technique.

 

https://decibel.ni.com/content/docs/DOC-24775

 

Otherwise I agree that it is a huge time saver to use the vision development module.

 

Br,

 

/Roger

0 Kudos
Message 5 of 41
(5,933 Views)

We already tried ROI, but its a lot difficult since for us so we were not able to implement it. Also, we need it for implementing in another project. If you know how to help us in our problem with shifting 2d arrays it would be really appreciated. Thank you.

0 Kudos
Message 6 of 41
(5,915 Views)

I'm not sure if that is what we really needed. What we are trying to do is set a mark in the reference image and get its coordinates. Then we placed the mark of the actual image in the same coordinates from the mark of the reference image, thus aligning both images. Also, since we are comparing the images pixel by pixel, I think its better to use arrays? Please do help us if you know how to shift 2d arrays, Thank you. 

 

 

0 Kudos
Message 7 of 41
(5,910 Views)

@pinkman wrote:

I'm not sure if that is what we really needed. What we are trying to do is set a mark in the reference image and get its coordinates. Then we placed the mark of the actual image in the same coordinates from the mark of the reference image, thus aligning both images. Also, since we are comparing the images pixel by pixel, I think its better to use arrays? Please do help us if you know how to shift 2d arrays, Thank you. 

 

 


If you use the NI Machine Vision add-on, there are numerous examples that you can use as a starting point, implementation clues and inspiration for your solution(s).

 

http://www.ni.com/white-paper/6712/en

 

Br,

 

/Roger

 

0 Kudos
Message 8 of 41
(5,896 Views)

Another question which might make your approach very....questionable:

How are those images acquired?

 

You have to know that images are very dependent on lighting, rotation and position of the "target" as well as distance and focus from the camera. So it is not very likely that, even if you "shift the images to the correct pixel coordinate", the comparison of the images result in anything useful. How many "pixelerrors" do you find acceptable? Do you compare against ranges of color/brightness or simply a static bit compare?

 

There are more questions making the approach of a direct array comparison questionable in regard to "does it really solve your requirements".

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 41
(5,876 Views)

I don't know if it's really useful for your problem, but here is a very simple code (LabVIEW 2011) showing how to rotate 2D-arrays.

Best regards,

HL

 

PS. The "Tranpose 2D Array" VI makes it not necessary to know the size of the array.

Message 10 of 41
(5,859 Views)