RED-3813: Recategorize same image as experimental feature

added representation to image and DocumentStructure
This commit is contained in:
yhampe 2024-05-17 07:34:05 +02:00
parent b867deb9f9
commit a5fcebce30
6 changed files with 10 additions and 3 deletions

View File

@ -43,6 +43,8 @@ public class DocumentStructure implements Serializable {
public static final String POSITION = "position"; public static final String POSITION = "position";
public static final String ID = "id"; public static final String ID = "id";
public static final String REPRESENTATION_HASH="representationHash";
} }
@Schema(description = "Object containing the extra field names, a table cell has in its properties field.") @Schema(description = "Object containing the extra field names, a table cell has in its properties field.")

View File

@ -281,7 +281,7 @@ public class LayoutParsingPipeline {
pdfImages.computeIfAbsent(pageNumber, x -> new ArrayList<>()) pdfImages.computeIfAbsent(pageNumber, x -> new ArrayList<>())
.addAll(graphics.stream() .addAll(graphics.stream()
.map(g -> new ClassifiedImage(new Rectangle2D.Double(g.x1, g.y1, g.width(), g.height()), ImageType.GRAPHIC, false, stripper.getPageNumber())) .map(g -> new ClassifiedImage(new Rectangle2D.Double(g.x1, g.y1, g.width(), g.height()), ImageType.GRAPHIC, false, stripper.getPageNumber(),""))
.toList()); .toList());
ClassificationPage classificationPage = switch (layoutParsingType) { ClassificationPage classificationPage = switch (layoutParsingType) {

View File

@ -35,6 +35,8 @@ public class Image implements GenericSemanticNode {
List<Integer> treeId; List<Integer> treeId;
String id; String id;
String representationHash;
ImageType imageType; ImageType imageType;
boolean transparent; boolean transparent;
Rectangle2D position; Rectangle2D position;

View File

@ -24,5 +24,7 @@ public class ClassifiedImage {
private boolean hasTransparency; private boolean hasTransparency;
@NonNull @NonNull
private int page; private int page;
@NonNull
private String representation;
} }

View File

@ -32,7 +32,7 @@ public class ImageServiceResponseAdapter {
.add(new ClassifiedImage(new Rectangle2D.Double(imageMetadata.getPosition().getX1(), .add(new ClassifiedImage(new Rectangle2D.Double(imageMetadata.getPosition().getX1(),
imageMetadata.getPosition().getY1(), imageMetadata.getPosition().getY1(),
imageMetadata.getGeometry().getWidth(), imageMetadata.getGeometry().getWidth(),
imageMetadata.getGeometry().getHeight()), classification, imageMetadata.isAlpha(), imageMetadata.getPosition().getPageNumber())); imageMetadata.getGeometry().getHeight()), classification, imageMetadata.isAlpha(), imageMetadata.getPosition().getPageNumber(),imageMetadata.getRepresentation()));
}); });
// Currently This is a copy but, it will be changed later because i don' t think that we should unclassified images. // Currently This is a copy but, it will be changed later because i don' t think that we should unclassified images.
@ -44,7 +44,7 @@ public class ImageServiceResponseAdapter {
.add(new ClassifiedImage(new Rectangle2D.Double(imageMetadata.getPosition().getX1(), .add(new ClassifiedImage(new Rectangle2D.Double(imageMetadata.getPosition().getX1(),
imageMetadata.getPosition().getY1(), imageMetadata.getPosition().getY1(),
imageMetadata.getGeometry().getWidth(), imageMetadata.getGeometry().getWidth(),
imageMetadata.getGeometry().getHeight()), classification, imageMetadata.isAlpha(), imageMetadata.getPosition().getPageNumber())); imageMetadata.getGeometry().getHeight()), classification, imageMetadata.isAlpha(), imageMetadata.getPosition().getPageNumber(),imageMetadata.getRepresentation()));
}); });
return images; return images;

View File

@ -12,6 +12,7 @@ import lombok.NoArgsConstructor;
public class ImageMetadata { public class ImageMetadata {
private Classification classification; private Classification classification;
private String representation;
private Position position; private Position position;
private Geometry geometry; private Geometry geometry;
private Filters filters; private Filters filters;