mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.9 KiB
64 lines
1.9 KiB
14 years ago
|
package org.opencv.test.highgui;
|
||
14 years ago
|
|
||
13 years ago
|
import org.opencv.core.MatOfByte;
|
||
12 years ago
|
import org.opencv.core.MatOfInt;
|
||
11 years ago
|
import org.opencv.imgcodecs.Imgcodecs;
|
||
14 years ago
|
import org.opencv.test.OpenCVTestCase;
|
||
|
import org.opencv.test.OpenCVTestRunner;
|
||
14 years ago
|
|
||
13 years ago
|
public class HighguiTest extends OpenCVTestCase {
|
||
|
|
||
|
public void testImdecode() {
|
||
|
fail("Not yet implemented");
|
||
|
}
|
||
|
|
||
|
public void testImencodeStringMatListOfByte() {
|
||
13 years ago
|
MatOfByte buff = new MatOfByte();
|
||
|
assertEquals(0, buff.total());
|
||
11 years ago
|
assertTrue( Imgcodecs.imencode(".jpg", gray127, buff) );
|
||
13 years ago
|
assertFalse(0 == buff.total());
|
||
13 years ago
|
}
|
||
|
|
||
|
public void testImencodeStringMatListOfByteListOfInteger() {
|
||
11 years ago
|
MatOfInt params40 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
|
||
|
MatOfInt params90 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 90);
|
||
12 years ago
|
/* or
|
||
12 years ago
|
MatOfInt params = new MatOfInt();
|
||
11 years ago
|
params.fromArray(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
|
||
12 years ago
|
*/
|
||
12 years ago
|
MatOfByte buff40 = new MatOfByte();
|
||
|
MatOfByte buff90 = new MatOfByte();
|
||
|
|
||
11 years ago
|
assertTrue( Imgcodecs.imencode(".jpg", rgbLena, buff40, params40) );
|
||
|
assertTrue( Imgcodecs.imencode(".jpg", rgbLena, buff90, params90) );
|
||
12 years ago
|
|
||
|
assertTrue(buff40.total() > 0);
|
||
|
assertTrue(buff40.total() < buff90.total());
|
||
13 years ago
|
}
|
||
14 years ago
|
|
||
13 years ago
|
public void testImreadString() {
|
||
11 years ago
|
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH);
|
||
13 years ago
|
assertTrue(!dst.empty());
|
||
|
assertEquals(3, dst.channels());
|
||
|
assertTrue(512 == dst.cols());
|
||
|
assertTrue(512 == dst.rows());
|
||
|
}
|
||
14 years ago
|
|
||
13 years ago
|
public void testImreadStringInt() {
|
||
11 years ago
|
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH, 0);
|
||
13 years ago
|
assertTrue(!dst.empty());
|
||
|
assertEquals(1, dst.channels());
|
||
|
assertTrue(512 == dst.cols());
|
||
|
assertTrue(512 == dst.rows());
|
||
|
}
|
||
14 years ago
|
|
||
13 years ago
|
public void testImwriteStringMat() {
|
||
|
fail("Not yet implemented");
|
||
|
}
|
||
|
|
||
|
public void testImwriteStringMatListOfInteger() {
|
||
|
fail("Not yet implemented");
|
||
|
}
|
||
|
|
||
14 years ago
|
}
|