File: test_image.py

package info (click to toggle)
alicevision 3.3.1%2Brepack-3
  • links: PTS, VCS
  • area: contrib
  • in suites: sid
  • size: 34,232 kB
  • sloc: cpp: 142,191; python: 13,724; ansic: 7,937; modula3: 6,977; sh: 163; makefile: 66
file content (85 lines) | stat: -rw-r--r-- 3,260 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
Collection of unit tests for image
"""

import pytest

from pyalicevision import image as img
import numpy as np

def test_default_constructor():
    image = img.Image_uchar()
    assert (image.width() == 0), "default width is 0"
    assert (image.height() == 0), "default height is 0"
    assert (image.depth() == 1), "Incorrect depth"
    assert (image.channels() == 1), "Incorrect channels"

    image = img.Image_float()
    assert (image.width() == 0), "default width is 0"
    assert (image.height() == 0), "default height is 0"
    assert (image.depth() == 4), "Incorrect depth"
    assert (image.channels() == 1), "Incorrect channels"


    image = img.Image_RGBAfColor()
    assert (image.width() == 0), "default width is 0"
    assert (image.height() == 0), "default height is 0"
    assert (image.depth() == 16), "Incorrect depth"
    assert (image.channels() == 4), "Incorrect channels"

    image = img.Image_RGBAColor()
    assert (image.width() == 0), "default width is 0"
    assert (image.height() == 0), "default height is 0"
    assert (image.depth() == 4), "Incorrect depth"
    assert (image.channels() == 4), "Incorrect channels"

    image = img.Image_RGBfColor()
    assert (image.width() == 0), "default width is 0"
    assert (image.height() == 0), "default height is 0"
    assert (image.depth() == 12), "Incorrect depth"
    assert (image.channels() == 3), "Incorrect channels"

    image = img.Image_RGBColor()
    assert (image.width() == 0), "default width is 0"
    assert (image.height() == 0), "default height is 0"
    assert (image.depth() == 3), "Incorrect depth"
    assert (image.channels() == 3), "Incorrect channels"

def test_constructor():
    image = img.Image_uchar(10, 12)
    assert (image.width() == 10), "default width is 10"
    assert (image.height() == 12), "default height is 12"
    assert (image.depth() == 1), "Incorrect depth"
    assert (image.channels() == 1), "Incorrect channels"

    image = img.Image_float(10, 12)
    assert (image.width() == 10), "default width is 10"
    assert (image.height() == 12), "default height is 12"
    assert (image.depth() == 4), "Incorrect depth"
    assert (image.channels() == 1), "Incorrect channels"


    image = img.Image_RGBAfColor(10, 12)
    assert (image.width() == 10), "default width is 10"
    assert (image.height() == 12), "default height is 12"
    assert (image.depth() == 16), "Incorrect depth"
    assert (image.channels() == 4), "Incorrect channels"

    image = img.Image_RGBAColor(10, 12)
    assert (image.width() == 10), "default width is 10"
    assert (image.height() == 12), "default height is 12"
    assert (image.depth() == 4), "Incorrect depth"
    assert (image.channels() == 4), "Incorrect channels"

    image = img.Image_RGBfColor(10, 12)
    assert (image.width() == 10), "default width is 10"
    assert (image.height() == 12), "default height is 12"
    assert (image.depth() == 12), "Incorrect depth"
    assert (image.channels() == 3), "Incorrect channels"

    image = img.Image_RGBColor(10, 12)
    assert (image.width() == 10), "default width is 10"
    assert (image.height() == 12), "default height is 12"
    assert (image.depth() == 3), "Incorrect depth"
    assert (image.channels() == 3), "Incorrect channels"