(test) formatting
This commit is contained in:
@@ -119,11 +119,11 @@ void main() async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Improved blending - treating black pixels as transparent
|
// Improved blending - treating black pixels as transparent
|
||||||
final blendedImage = Float32List(width * height * 4);
|
final blendedImage = Float32List(width * height * 4);
|
||||||
final weightSums = List<double>.filled(width * height, 0.0);
|
final weightSums = List<double>.filled(width * height, 0.0);
|
||||||
|
|
||||||
// For each image
|
// For each image
|
||||||
for (final image in images) {
|
for (final image in images) {
|
||||||
// For each pixel in the image
|
// For each pixel in the image
|
||||||
for (int p = 0; p < width * height; p++) {
|
for (int p = 0; p < width * height; p++) {
|
||||||
final baseIdx = p * 4;
|
final baseIdx = p * 4;
|
||||||
@@ -148,10 +148,10 @@ for (final image in images) {
|
|||||||
weightSums[p] += weight;
|
weightSums[p] += weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize by the accumulated weights
|
// Normalize by the accumulated weights
|
||||||
for (int p = 0; p < width * height; p++) {
|
for (int p = 0; p < width * height; p++) {
|
||||||
final baseIdx = p * 4;
|
final baseIdx = p * 4;
|
||||||
final weightSum = weightSums[p];
|
final weightSum = weightSums[p];
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ for (int p = 0; p < width * height; p++) {
|
|||||||
blendedImage[baseIdx + 2] = 0;
|
blendedImage[baseIdx + 2] = 0;
|
||||||
blendedImage[baseIdx + 3] = 0;
|
blendedImage[baseIdx + 3] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set the blended data to the projectedImage
|
// Set the blended data to the projectedImage
|
||||||
final data = await projectedImage.getData();
|
final data = await projectedImage.getData();
|
||||||
data.setRange(0, data.length, blendedImage);
|
data.setRange(0, data.length, blendedImage);
|
||||||
|
|||||||
Reference in New Issue
Block a user