[ptx] Re: Enblend suggestion: focus score weighting
Pablo d'Angelo
pablo.dangelo at web.de
Thu Jun 17 20:02:08 BST 2004
On Thu, 17 Jun 2004, Andrew C Mihal wrote:
> On Wed, 16 Jun 2004, Sebastian Nowozin wrote:
>
> Another interesting metric would be: this pixel is too far out of
> consensus with other overlapping input pixels. This might be a way to
> identify ghosts. You have to decide whether to keep the ghost or delete it
> though.
I have already thought about something like that, maybe correlating small
area patches and using only one patch if the correlation coefficient is too
low.
Something else: I have worked on vigra's import/export module to support
arbitrary image types with alpha channel, and the hugin cvs contains
functions to to this, in case you're interested in that.
Currently there is a small bug somewhere that incorrectly converts the 16/32
bit or float alpha channels to 8 bit, but I'll fix that soon. The interface
should will stay the same and looks like that:
vigra_impex2::ImageImportInfo info(filename);
// total number of channels
int bands = info.numBands();
// number of extra (non color) channels, usually just one alpha mask,
// but could be more for tiff files.
int extraBands = info.numExtraBands();
// single channel image
if (bands == 1 || bands == 2 && extraBands == 1) {
if (strcmp(pixelType, "UINT8") == 0 ) {
// 8 bit image
BImage gray;
BImage mask;
// will add an all 255 alpha channel if image doesn't contain one.
// usually one wants to call a template function that does all the
// stitching/blending, instead of just importing the image.
vigra_impex2::importImageAlpha(info, destImage(gray), destImage(alpha);
} if (strcmp(pixelType, "FLOAT") == 0 ) {
FImage gray;
BImage mask;
vigra_impex2::importImageAlpha(info, destImage(gray), destImage(alpha);
}
...
} else if (bands == 3 || bands == 4 && extraBands == 1) {
...
}
Exporting images with alpha channel can be done with:
exportImageAlpha(srcImageRange(gray), srcImage(alpha), info);
for TIFF, 8, 16 and 32 bit images, as well as float and double images
are supported. PNG supports only uint8 and uint16 images.
ciao
Pablo
More information about the ptX
mailing list