Posted: 2006-12-10T19:27:09-07:00
You are asking for a couple of VERY complex taskes, whcih is beyond the scope of a single question. basically people do not want to do ALL the work for you.
You first need to ask yourself. Do you plan to do this for hundereds of images?
or just one or two sets? In that later... do it by hand with a GUI photo processing problem. In the former (hundreded of images), then you need IM and figure out how to automate the process.
You however can split your problem in three seperate, but still very difficult problems, and these are what you need to work out, one step at a time.
First you have multiple images! You need to first find a way to cut out and seperate the verious parts you are interested it.
The simplist method is to 'cut' the images into parts. That is start by looking for a vertical line of the background color along whcih you can 'cut' the image into two smaller parts, then repeat with those parts.
You can then repeate this process with slanted, though straight lines.
not that this can fail if you need a crooked lines or curves to seperate the images, but that does not appear to be the can with your example.
A alturnative an more general solution can be solved by masking the image using just the background color, then using -segment (with a -verbose setting) to find the various parts, so you can seperateally mask these out from the original image.
Play with -verbose and -segment. I have not looked at this process in much detail in IM Examples, so if you do this please report your successes and failures back to me, so the results can be sared with others.
if you are unwilling, ask a seperate question on the forums for this step, either as a
'cut' solution or as a 'segment' solution.
Second. After you have the sub-images seperated the next difficult step is aligning (rotating) the images back into right allignment. That brings up the question. of finding what the 'corners' of each image is, and figuring out which way is UP!
Third. Once you have the locations of the 'corners' you can then figure out the
rotataion you need to re-align the images, assuming the images are rectangles!
This can be solved with some 'affine transformations' the solution of which is still being worked out in IM examples. That is a 3 point transformation.
However as you are dealing with a 4 point rectangle you may want to use a 4 point perspective transformation. Recent discussions may make 4 point transformations posible in IM very soon.
Basically you need to think about things and experiment with -segment to solve the first problem.
You first need to ask yourself. Do you plan to do this for hundereds of images?
or just one or two sets? In that later... do it by hand with a GUI photo processing problem. In the former (hundreded of images), then you need IM and figure out how to automate the process.
You however can split your problem in three seperate, but still very difficult problems, and these are what you need to work out, one step at a time.
First you have multiple images! You need to first find a way to cut out and seperate the verious parts you are interested it.
The simplist method is to 'cut' the images into parts. That is start by looking for a vertical line of the background color along whcih you can 'cut' the image into two smaller parts, then repeat with those parts.
You can then repeate this process with slanted, though straight lines.
not that this can fail if you need a crooked lines or curves to seperate the images, but that does not appear to be the can with your example.
A alturnative an more general solution can be solved by masking the image using just the background color, then using -segment (with a -verbose setting) to find the various parts, so you can seperateally mask these out from the original image.
Play with -verbose and -segment. I have not looked at this process in much detail in IM Examples, so if you do this please report your successes and failures back to me, so the results can be sared with others.
if you are unwilling, ask a seperate question on the forums for this step, either as a
'cut' solution or as a 'segment' solution.
Second. After you have the sub-images seperated the next difficult step is aligning (rotating) the images back into right allignment. That brings up the question. of finding what the 'corners' of each image is, and figuring out which way is UP!
Third. Once you have the locations of the 'corners' you can then figure out the
rotataion you need to re-align the images, assuming the images are rectangles!
This can be solved with some 'affine transformations' the solution of which is still being worked out in IM examples. That is a 3 point transformation.
However as you are dealing with a 4 point rectangle you may want to use a 4 point perspective transformation. Recent discussions may make 4 point transformations posible in IM very soon.
Basically you need to think about things and experiment with -segment to solve the first problem.