Problem with accents and special characters, on Resize Imgproc Java

asked 2014-06-18 09:30:04 -0600

charlestff gravatar image

updated 2014-06-18 10:02:08 -0600

I'm doing the processing of files containing accents and special letters such as "º", so when you try to rotate the image or resize using Imgproc, the following error is issued:

String originalFileName = "D:\\ºteste\\teste4.jpg"
Mat image =  Highgui.imread(originalFileName);

int width = image.cols();
int height = image.rows();

double resizeRate = 0;

if (resizeToHeight <= 0) {
    resizeRate = ((resizeToWidth * 100.0) / width) / 100.0;
}

if (resizeToWidth <= 0) {
    resizeRate = ((resizeToHeight * 100.0) / height) / 100.0;
}

Mat resizeImage = new Mat();

if (resizeRate > 0) {
    Size sz = new Size(resizeRate * width, resizeRate * height);
    Imgproc.resize(image, resizeImage, sz);
} else {
    Size sz = new Size(resizeToWidth, resizeToHeight);
    Imgproc.resize(image, resizeImage, sz);
}

Message on Rotate

" OpenCV Error: Assertion failed (src.cols > 0 && src.rows > 0) in cv::warpAffine, file ........\opencv\modules\imgproc\src\imgwarp.cpp, line 3455 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\imgproc\src\imgwarp.cpp:3455: error: (-215) src.cols > 0 && src.rows > 0 in function cv::warpAffine ] at org.opencv.imgproc.Imgproc.warpAffine_2(Native Method) at org.opencv.imgproc.Imgproc.warpAffine(Imgproc.java:9559) at juca.bastiao.Processor.autoRotate(Processor.java:258) at juca.bastiao.Processor.doResize(Processor.java:91) at juca.bastiao.Processor.resizeToFile(Processor.java:52) at juca.bastiao.Testes.main(Testes.java:30) "

Message on Resize

OpenCV Error: Assertion failed (ssize.area() > 0) in cv::resize, file ........\opencv\modules\imgproc\src\imgwarp.cpp, line 1834 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\imgproc\src\imgwarp.cpp:1834: error: (-215) ssize.area() > 0 in function cv::resize ] at org.opencv.imgproc.Imgproc.resize_1(Native Method) at org.opencv.imgproc.Imgproc.resize(Imgproc.java:8959) at juca.bastiao.Processor.doResize(Processor.java:111) at juca.bastiao.Processor.resizeToFile(Processor.java:52) at juca.bastiao.Testes.main(Testes.java:30)

edit retag flag offensive close merge delete