I think that you can do this in hugin through scripting.

The basic workflow would be like the way scanned images are stitched 
together:

Read:
https://hugin.sourceforge.io/tutorials/scans/en.shtml

The idea is to treat each image as a different lens in the hugin file, and 
stitch them as mosaic plane using a rectangular projection.
Think of the camera as if it was moving on a rail over the stationary 
slabs. For the optimization, hugin should deal only with movement in X and 
Y axis (and maybe rotation).  

For the camera original photos I would suggest to *use a format that is not 
jpeg*, shoot raw and work with images with a bit depth of 16 bits per 
color. More on that below.

The first image you need is a photo of the empty conveyor belt without any 
slabs. Just the empty space using the same lens and light.

Use that first image to automatically subtract the background from all of 
the images with slabs of marble. 
Generate what is called a "difference mask" or a "difference matte", and 
use that to add black, white or alpha around the slabs of marble.

For automated scripting that can be done with imagemagik

https://imagemagick.org/Usage/compose/#changemask

This will work best if the original files have no jpg compression 
artifacts. Shoot raw and convert to 16 bit tiff or png files.
Having images without a background will make it easier for Hugin to create 
control points that are only within surface of the slabs, and not in the 
conveyor belt.

Once you have a series of images that contain only the slabs, then you can 
run a script.
Here's an example in bash, but I'm sure porting it to python should not be 
difficult.
The goal of the script is to process a series of images on the current 
directory and stitch them together.









*#! /bin/sh# hugin command tools script to stitch images as a mosaic plane# 
use of fov >= 10 should be OK, could simply set FOV=10# set fov 
valueFOV=10#create a .pto project using all jpg files in current 
directory**pto_gen 
--projection=0 --fov=$FOV -o project.pto *.JPG*
#modify accordingly for tiff, or other formats

*# for loop that counts how many images exist, and then assigns a new lens 
to each one.*















*#modify for different image formats if needed.for I in $(seq 1 $(ls -f 
*JPG | wc -l))      do      pto_lensstack -o 01_project.pto --new-lens i$I 
project.ptodone#find control pointscpfind --prealigned -o 
02_control_points.pto  01_project.pto#clean control pointscpclean -v 
--max-distance=1 --pairwise-checking -o 03_clean_cp.pto 
02_control_points.pto# Optomization is set to rotation, X and Y 
coordinates.*
*pto_var -o 04_set_optim.pto --opt r,TrX,TrY,!r0,!TrX0,!TrY0 
03_clean_cp.pto*
*# if rotation creates problems then change to *-opt *TrX,TrY,!TrX0,!TrY0*






*#calculate the panorama using all the control points and set 
parametersautooptimiser -n -o 05_auto_optim.pto 04_set_optim.pto#set the 
projection to rectilinear and calculate croppingpano_modify  --projection=0 
--fov=AUTO --center --canvas=100% --crop=AUTO -o 
06_final_stitch_project.pto 05_auto_optim.pto*

You can use the hugin user interface to check each of the projects along 
the way,  and understand the logic behind it, and troubleshoot any problems.

On Saturday, August 3, 2024 at 4:43:33 AM UTC-7 [email protected] wrote:

> Hello,
>
> We are an Italian company named : Iride www.iridefoto.it
>
> we have developed an automatic photography system for marble slabs.
> We are taking photographs of marble slabs passing through the polishing 
> line.
>
> The photography position is fixed, meaning we always have the same shot.
>
> We have to compose the final marble slab starting, for example, from about 
> ten photographs.
> We take a picture every 60cm and the final slab will be for example around 
> 350cm.
> The pictures have overlapping areas to facilitate the joining.
>
> We have tryed to crop the photographs selecting only the marble part 
> before to perform the final algo.
> Basically we need to have a photo stitching solution.
>
> We will prefer to have a solution with Python as our script is already 
> written with this language.
>
> The script doesn't have to a "real-time one"
> We can process the pics and after "minutes/hour" produce the result for 
> every slab
>
> We have a demo of the images here :
>
> https://drive.google.com/drive/folders/1pkYErc_4Kdzajqlno6zACtNJRZJJ4GWp?usp=sharing
>
> We have played with this project on Git: with no good result.
> https://github.com/OpenStitching/stitching
>
>
> This is a job request that provides compensation to anyone who can provide 
> a software solution.
>
> Many thanks for your help.
> www.iridefoto.it
>

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/f50f143c-aceb-4649-84d4-bf02e70d6a77n%40googlegroups.com.

Reply via email to