loading
 
Image Module Problem
Franklin  [23 posts]
15 year
Hello Steven,




Iā€™m trying to align/register two images so I can find the difference in rotation and translation in real units.  The Align Image module seems to be the closest thing.  It is documented by does not seem to be in the pipeline.  Is there a way to use this module?


Thanks in advance
Franklin
Anonymous 15 year
Franklin,

Are the attached two images representative of the shapes that you want to align? The reason I ask is that the Align Image module (which is actually NOT released but somehow you found the documentation) works on textured images similar to ones taken of real world scenes. It would not work on the above images as they are only of basic shapes.

If the images are representative we can help you by suggesting serveral other modules which can tell the COG location and orientation of either objects. For example, the Shape Match module might provide what you are looking for. But before we offer a solution let us know if the images are representative of your project.

Thanks for the donation!

STeven.
Franklin  [23 posts] 15 year

Hi STeven,

Thanks for the question.  There most representative/useful images are:

1) Real world raw images files produced by a Canon XSI (12MP) under remote computer control (machine vision setup)
2) Images like the one below.  

The basic images from the previous email were to help convey ideal.  I suppose if you didn't blur the edge features too much you could simply a real world image and get some metrics from it.

Anonymous 15 year
Franklin,

Actually it is very important to use real images when testing if that is the intended use. Real and artificial images have such huge differences (mainly due to noise) that a solution for one will most likely not work for another.

Perhaps we can back up a bit and understand better what your overall project goal is. If the repeated image of the book above simply needs to be analyzed for rotation then the Orient Image Module at

http://www.roborealm.com/help/Orient_Image.php

will give you a base rotation whenever that image is seen. You'd simply see what ORIENT_IMAGE_ROTATION is for the correct image and compare it with a test image to see the difference between the two orientations. The orientation is based on the image content. Same content = same orientation. That would tell you if the test image is more or less in the same orientation as the original.

For translation you could simply use the Center of Gravity which would give you the same spot in both images in COG_X and COG_Y. Comparing those variables would then give you the delta in translation. (Both these techniques might even work for the first images you posted too).

I've purposely steered away from shape or image matching until we better understand what the image qualities are that can be relied on. The above techniques are easy to understand and easy to see when and if they go wrong.

Perhaps you can include another of the above pattern image in a bad orientation and we can then give you a sample robofile with the above modules added?

Also are the images being created looking down at a conveyor belt or can it be assumed that the entire object is in camera view for a small period of time? I.e. are objects isolated or always connected in a ribbon type of fashion?

Thanks,
STeven.
Franklin  [23 posts] 15 year

STeven

- The entire image will be in camera view for small period of time.  The objects (book covers in this example) will be fixed in place on top of a rectangular sheet.  The entire sheet will be removed and another one placed in front of the camera.  The orientation of the book cover is what is unpredictable.  

- I can go make another picture of a different orientation.  
Anonymous 15 year
Franklin,

Getting the image as close as possible to what you will be working on is idea. If you've had a chance to take more photos please post them here.

Based on your description it should be very easy to segment the book from the background (assuming white or black sheet here) and then get the alignment of the book using the geometry module (see angle or angle_alt) and the center of gravity COG_X and COGY (also in that module).

It is just much easier if we have a valid image to work with.

STeven.
Franklin  [23 posts] 15 year

Hello STeven,


Sorry fore the wait.  I was out with the flu.

I have two sets of test images.  Each set has a reference level image (approx) and an image tilted at an angle. The orient module seems to fail for the first set of images (pages) and work OK for the second set (cover).  The images are a bit large so I will make separate postings.  

BTW ā€“ Angle in the geometry module never seemed to be consistent.  Maybe it is just my interpretation.


[image1]


[image2]

Franklin  [23 posts] 15 year

Here is the second set:

[image1]



[image2]

Franklin  [23 posts] 15 year

Hello STeven,


Sorry fore the wait.  I was out with the flu and had a couple of other set backs.

I have two sets of test images.  Each set has a reference level image (approx) and an image tilted at an angle.  

BTW ā€“ Angle in the geometry module never seemed to be consistent.  Maybe it is just my interpretation.

BTW (Part2) - If the images are too big the system fails quietly and does not update the thread - just FYI

, , ,

Anonymous 15 year
Franklin,

I've attached a robofile that should do the trick (mostly). The basic idea is to isolate just the print (this is done by thresholding and removing all but the largest object as the print is assumed to be mostly white in contrast to the background) and then using the orient_image module to align the graphic to a standard orientation.

You will notice that the first two images align to -80 and 90 deg. So even for what you consider the correct layout you will get an alignment degree. That is due to the orient_image module just picking the best standard orientation and aligning the image wrt to that angle. This will differ for each image that is used. Is this ok?

The Geometry module angle will not be consistent as a square (or rect) has no intrinsic orientation (it has a 180 degree symmetry). It that is ok then you might be able to use the Geometry module in place of the orient_image module.

Note that the second image set does not work 100% as there is still a slight rotation on the 3rd image. This is due to the lack of image contrast (helped by the equalize module) in that the orient_image module is having issues in aligning the image based on its content.

Let me know if this helps with your project and/or issues with this solution.

STeven.

program.robo
Anonymous 15 year
And if you don't mind the 180 issue you can try the following robofile that ids three corners of the square and determines the angle based on the second longest segment (the longest being the diagonal across the square). Note that this technique sees the default as 180 BUT it cannot tell that the first and second image above are actually rotated by 180 and just sees the first image as being off by about 10 deg instead of 190.

This is also an example of how to calculate angles based on a primitive shape and also shows the issues in objects that do not have any unique alignment.

Note that the VBScript module is used to determine the actual angle ...

STeven.
program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index