47 lines
1.2 KiB
Java
47 lines
1.2 KiB
Java
package pl.edu.amu.wmi.bookapi.service;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
@Service
|
|
public class ImageProcessingService {
|
|
|
|
public ImageProcessingService() {
|
|
|
|
}
|
|
|
|
public String getDecodedEan(MultipartFile imageFile) throws Exception {
|
|
|
|
return "";
|
|
//
|
|
// String fileId = UUID.randomUUID().toString();
|
|
// Path path = Path.of(new File(".").getCanonicalPath());
|
|
//
|
|
// byte[] starting = imageFile.getBytes();
|
|
//
|
|
// saveImg(starting, path, fileId, 1);
|
|
//
|
|
// Mat mat = Imgcodecs.imdecode(new MatOfByte(starting), Imgcodecs.IMREAD_GRAYSCALE);
|
|
//
|
|
// Mat gray = new Mat();
|
|
// Imgproc.cvtColor(mat, gray, COLOR_BGR2GRAY);
|
|
//
|
|
// byte[] grayed = mat2byteArr(gray);
|
|
//
|
|
// saveImg(grayed, path, fileId, 2);
|
|
//
|
|
// return "";
|
|
}
|
|
|
|
// private byte[] mat2byteArr(Mat mat) {
|
|
// byte[] bytes = new byte[0];
|
|
// mat.get(0, 0, bytes);
|
|
// return bytes;
|
|
// }
|
|
//
|
|
// private void saveImg(byte[] bytes, Path path, String imageName, Integer version) throws IOException {
|
|
// Files.write(Path.of(path.toString(), "/" + imageName + "__v" + version + ".png"), bytes);
|
|
// }
|
|
}
|