An open API service indexing awesome lists of open source software.

https://github.com/cuupa/perspective-corrector

A simple document perspective corretion
https://github.com/cuupa/perspective-corrector

image-processing opencv python3

Last synced: about 2 months ago
JSON representation

A simple document perspective corretion

Awesome Lists containing this project

README

          

# perspective_corrector

Perspective correction of documents with OpenCV.

Listens per default at port 5000

## Arguments
-port [portnumber]

## Provides
[GET/POST] /api/status
[POST] /api/image/transform


## Usage

### Spring Rest
final byte[] payload = readFile();

RestTemplate upload = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "multipart/form-data");
headers.set("Accept", "*/*");

MultiValueMap fileMap = new LinkedMultiValueMap<>();
ContentDisposition contentDisposition = ContentDisposition.builder("form-data")
.name("key")
.filename("perspective.png")
.build();

fileMap.add("Content-Disposition", contentDisposition.toString());
fileMap.add("Content-Type", "image/jpeg");

HttpEntity entity = new HttpEntity<>(payload, fileMap);
MultiValueMap body = new LinkedMultiValueMap<>();
body.add("file", entity);
HttpEntity> requestData = new HttpEntity<>(body, headers);

ResponseEntity responseEntity = upload.postForEntity("http://127.0.0.1:5000/api/image/transform", requestData, byte[].class);