Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions imgparse/pixel_pitches.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"M4E": {
5280: 3.28e-06, # Wide camera (4/3" CMOS, 5280x3956)
},
"M4D": {
5280: 3.28e-06, # Wide camera (4/3" CMOS, 5280x3956)
},
"FC6360": 3.0e-06, # Phantom 4 Multispectral
"FC6310R": 2.41e-06, # Phatom 4 Pro RTK
"M3M": 3.28e-06, # Mavic 3 Multispectral
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "imgparse"
version = "2.0.13"
version = "2.0.14"
description = "Python image-metadata-parser utilities"
authors = []
include = [
Expand Down
40 changes: 40 additions & 0 deletions tests/test_imgparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,34 @@ def m4e_tele_parser() -> MetadataParser:
return parser


@pytest.fixture
def m4d_wide_parser() -> MetadataParser:
parser = MetadataParser(base_path / "M4D_wide.JPG")
parser._exif_data = {
"Image Make": Tag("DJI"),
"Image Model": Tag("M4D"),
"EXIF FocalLength": Tag([Ratio(1229, 100)]),
"EXIF ExifImageWidth": Tag([5280]),
"EXIF ExifImageLength": Tag([3956]),
}
parser._xmp_data = {}
return parser


@pytest.fixture
def m4d_tele_parser() -> MetadataParser:
parser = MetadataParser(base_path / "M4D_tele.JPG")
parser._exif_data = {
"Image Make": Tag("DJI"),
"Image Model": Tag("M4D"),
"EXIF FocalLength": Tag([Ratio(1229, 100)]),
"EXIF ExifImageWidth": Tag([8064]),
"EXIF ExifImageLength": Tag([6048]),
}
parser._xmp_data = {}
return parser


@pytest.fixture
def dji_homepoint_parser() -> MetadataParser:
return MetadataParser(base_path / "DJI_home_point.jpg")
Expand Down Expand Up @@ -194,6 +222,18 @@ def test_get_camera_params_m4e_non_wide_unsupported(
m4e_tele_parser.pixel_pitch_meters()


def test_get_camera_params_m4d_wide(m4d_wide_parser: MetadataParser) -> None:
assert m4d_wide_parser.pixel_pitch_meters() == 3.28e-06
assert m4d_wide_parser.focal_length_pixels() == pytest.approx(3746.9512, abs=1e-04)


def test_get_camera_params_m4d_non_wide_unsupported(
m4d_tele_parser: MetadataParser,
) -> None:
with pytest.raises(ParsingError):
m4d_tele_parser.pixel_pitch_meters()


def test_get_camera_params_sentera(sentera_parser: MetadataParser) -> None:
focal1 = sentera_parser.focal_length_meters()
pitch = sentera_parser.pixel_pitch_meters()
Expand Down
Loading