You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing stitch operation with merge function, there are some artifacts and misalignment. I tried with mosaic function but i could not achieve a good result
Our system consist of motorized stages (stepper)
How to improve stitched image result, should I increase overlap ratio or decrease ?
You can reach files and stitched img from this drive link
Here is the code :
import time
import pyvips
# overlap joins by this many pixels
H_OVERLAP = 144
V_OVERLAP = 256
# number of images in mosaic
ACROSS = 23
DOWN = 15
row = 0
def join_left_right(filenames):
global row
images = [pyvips.Image.new_from_file(filename) for filename in filenames]
row = images[0]
for image in images[1:]:
row = row.merge(image, 'horizontal', H_OVERLAP - row.width, 0, mblend=50)
#row = row.mosaic(image, "horizontal",
# 0, 0,
# image.width * (1 - h_overlap), 0, mblend=100)
return row
def join_top_bottom(rows):
image = rows[0]
for row in rows[1:]:
image = image.merge(row, 'vertical', 0, V_OVERLAP - image.height, mblend=50)
#image = image.mosaic(row, "vertical",
# 0, 0,
# row.height * (1 - v_overlap), mblend=100)
return image
rows = []
files = []
file = []
for i in range(DOWN):
for j in range(ACROSS):
file.append("image"+str(i) + "_" + str(j) + ".jpg")
files.append(file)
file = []
for y in range(0, DOWN):
rows.append(join_left_right(files[y]))
image = join_top_bottom(rows)
image.write_to_file("stitched.tif", pyramid=True, tile=True,compression="jpeg")
Thank you from now
The text was updated successfully, but these errors were encountered:
I've not looked at your images, but the general advice is:
Camera focal plane: the sensor need to be co-planar with both your object, and with the plane of movement of the translation stage. This can be very hard to get exactly right :( The last time I did this I spent a long time driving the stage left/right/up/down and seeing how specks of dust on the object moved. Each time, you remove the camera, insert shims, and try again.
Lens distortion: pincushioning or barrelling needs to be less then a few pixels. There are various ways of measuring and correcting this, the simplest is to get a grating target and image that.
Translation stage errors: these are never exactly straight, and especially errors in the cutting of the screws can be significant. It depends how good your stage is. Again, it'd be worth trying to characterise your stage.
A simple experiment is to drive the stage to 100 positions, chosen to get a speck of dust positioned in a 10 x 10 grid filling the field of view of the camera. Find the pixel (x, y) position of the point in each frame and see if those points have a linear relationship, ie. are square-ish. If they are not, you have some uncorrected errors somewhere you need to fix.
Hi @jcupitt,
When doing stitch operation with
merge
function, there are some artifacts and misalignment. I tried withmosaic
function but i could not achieve a good resultOur system consist of motorized stages (stepper)
How to improve stitched image result, should I increase overlap ratio or decrease ?
You can reach files and stitched img from this drive link
Here is the code :
Thank you from now
The text was updated successfully, but these errors were encountered: