Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions docs/code_samples/barcode_reader_v1.txt

This file was deleted.

41 changes: 0 additions & 41 deletions docs/code_samples/idcard_fr_v1.txt

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/com/mindee/v1/cli/CommandLineInterfaceProducts.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mindee.v1.cli;

import com.mindee.v1.product.barcodereader.BarcodeReaderV1;
import com.mindee.v1.product.cropper.CropperV1;
import com.mindee.v1.product.driverlicense.DriverLicenseV1;
import com.mindee.v1.product.financialdocument.FinancialDocumentV1;
Expand Down Expand Up @@ -47,17 +46,6 @@ void bankAccountDetailsV2Method(
System.out.println(processor.standardProductOutput(BankAccountDetailsV2.class, file));
}

@CommandLine.Command(name = "barcode-reader", description = "Parse using Barcode Reader")
void barcodeReaderV1Method(
@CommandLine.Parameters(
index = "0",
paramLabel = "<path>",
scope = CommandLine.ScopeType.LOCAL
) File file
) throws IOException, InterruptedException {
System.out.println(processor.standardProductOutput(BarcodeReaderV1.class, file));
}

@CommandLine.Command(name = "fr-carte-grise", description = "Parse using FR Carte Grise")
void carteGriseV1Method(
@CommandLine.Parameters(
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package com.mindee.image;
package com.mindee.v1.fileoperations;

import static com.mindee.TestingUtilities.getResourcePath;
import static com.mindee.TestingUtilities.getV1ResourcePath;

import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mindee.image.ExtractedImage;
import com.mindee.image.ImageExtractor;
import com.mindee.input.LocalInputSource;
import com.mindee.v1.parsing.common.Page;
import com.mindee.v1.parsing.common.PredictResponse;
import com.mindee.v1.product.barcodereader.BarcodeReaderV1;
import com.mindee.v1.product.barcodereader.BarcodeReaderV1Document;
import com.mindee.v1.product.multireceiptsdetector.MultiReceiptsDetectorV1;
import com.mindee.v1.product.multireceiptsdetector.MultiReceiptsDetectorV1Document;
import java.io.IOException;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class ImageExtractorTest {
public class MultiReceiptsExtractionTest {

protected PredictResponse<MultiReceiptsDetectorV1> getMultiReceiptsPrediction(
String name
Expand All @@ -36,22 +36,6 @@ protected PredictResponse<MultiReceiptsDetectorV1> getMultiReceiptsPrediction(
);
}

protected PredictResponse<BarcodeReaderV1> getBarcodeReaderPrediction(
String name
) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules();

JavaType type = objectMapper
.getTypeFactory()
.constructParametricType(PredictResponse.class, BarcodeReaderV1.class);
return objectMapper
.readValue(
getV1ResourcePath("products/barcode_reader/response_v1/" + name + ".json").toFile(),
type
);
}

@Test
public void givenAnImage_shouldExtractPositionFields() throws IOException {
LocalInputSource image = new LocalInputSource(
Expand Down Expand Up @@ -83,41 +67,6 @@ public void givenAnImage_shouldExtractPositionFields() throws IOException {
}
}

@Test
public void givenAnImage_shouldExtractValueFields() throws IOException {
PredictResponse<BarcodeReaderV1> response = getBarcodeReaderPrediction("complete");
BarcodeReaderV1 inference = response.getDocument().getInference();

ImageExtractor extractor = new ImageExtractor(
new LocalInputSource(getV1ResourcePath("products/barcode_reader/default_sample.jpg"))
);
Assertions.assertEquals(1, extractor.getPageCount());

for (Page<BarcodeReaderV1Document> page : inference.getPages()) {
List<ExtractedImage> codes1D = extractor
.extractImagesFromPage(page.getPrediction().getCodes1D(), page.getPageId());
for (int i = 0; i < codes1D.size(); i++) {
ExtractedImage extractedImage = codes1D.get(i);
Assertions.assertNotNull(extractedImage.getImage());
LocalInputSource source = extractedImage.asInputSource();
Assertions
.assertEquals(
String
.format("default_sample_page-%3s-item-%3s.jpg", page.getPageId() + 1, i + 1)
.replace(" ", "0"),
source.getFilename()
);
extractedImage.writeToFile(getResourcePath("output/"));
}
List<ExtractedImage> codes2D = extractor
.extractImagesFromPage(page.getPrediction().getCodes2D(), page.getPageId());
for (ExtractedImage extractedImage : codes2D) {
Assertions.assertNotNull(extractedImage.getImage());
extractedImage.writeToFile(getResourcePath("output/"));
}
}
}

@Test
public void givenAPdf_shouldExtractPositionFields() throws IOException {
LocalInputSource image = new LocalInputSource(
Expand Down

This file was deleted.

Loading