MCPcopy Create free account
hub / github.com/daniel-e/rustml / test_colorimage

Function test_colorimage

src/opencv/mod.rs:983–1013  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

981
982 #[test]
983 fn test_colorimage() {
984 let i = RgbImage::from_file("datasets/testing/colors.png").unwrap();
985 assert_eq!(i.width(), 100);
986 assert_eq!(i.height(), 100);
987
988 // check that the red box exists
989 for y in (0..50) {
990 for x in (0..50) {
991 let p = i.pixel(x, y).unwrap();
992 assert!(p.r == 255 && p.b == 0 && p.g == 0);
993 }
994 }
995 for y in (0..50) {
996 for x in (50..100) {
997 let p = i.pixel(x, y).unwrap();
998 assert!(p.r == 255 && p.b == 255 && p.g == 255);
999 }
1000 }
1001 for y in (50..100) {
1002 for x in (0..50) {
1003 let p = i.pixel(x, y).unwrap();
1004 assert!(p.r == 0 && p.b == 0 && p.g == 0);
1005 }
1006 }
1007 for y in (50..100) {
1008 for x in (50..100) {
1009 let p = i.pixel(x, y).unwrap();
1010 assert!(p.r == 0 && p.b == 0 && p.g == 255);
1011 }
1012 }
1013 }
1014
1015 #[test]
1016 fn test_mask_image() {

Callers

nothing calls this directly

Calls 2

from_fileFunction · 0.85
pixelMethod · 0.80

Tested by

no test coverage detected