Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera crash ubuntu 22 gcc 9 5 #137

Closed
wants to merge 19 commits into from
Closed
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
7 changes: 3 additions & 4 deletions src/simulation/sensors/camera/_UnitTest/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
(0, 0, 0, 0, 0)
, (2, 2, 2, 1, 3)
])
# update "module" in this function name to reflect the module name
def test_module(show_plots, gauss, darkCurrent, saltPepper, cosmic, blurSize):
"""
**Validation Test Description**
Expand Down Expand Up @@ -98,9 +97,9 @@ def test_module(show_plots, gauss, darkCurrent, saltPepper, cosmic, blurSize):

# Clean up
imagePath = path + '/' + image
savedImage1 = '/'.join(imagePath.split('/')[:-1]) + '/' + str(gauss) + str(gauss) + str(darkCurrent) \
savedImage1 = '/'.join(imagePath.split('/')[:-1]) + '/' + str(gauss) + str(darkCurrent) \
+ str(saltPepper) + str(cosmic) + str(blurSize) + '0.000000.png'
savedImage2 = '/'.join(imagePath.split('/')[:-1]) + '/' + str(gauss) + str(gauss) + str(darkCurrent) \
savedImage2 = '/'.join(imagePath.split('/')[:-1]) + '/' + str(gauss) + str(darkCurrent) \
+ str(saltPepper) + str(cosmic) + str(blurSize) + '0.500000.png'
try:
os.remove(savedImage1)
Expand Down Expand Up @@ -147,7 +146,7 @@ def cameraTest(show_plots, image, gauss, darkCurrent, saltPepper, cosmic, blurSi
module.filename = imagePath
module.saveImages = True
# make each image saved have a unique name for this test case
module.saveDir = '/'.join(imagePath.split('/')[:-1]) + '/' + str(gauss) + str(gauss) + str(darkCurrent) \
module.saveDir = '/'.join(imagePath.split('/')[:-1]) + '/' + str(gauss) + str(darkCurrent) \
+ str(saltPepper) + str(cosmic) + str(blurSize)

# Create input message and size it because the regular creator of that message
Expand Down
29 changes: 14 additions & 15 deletions src/simulation/sensors/camera/_UnitTest/test_colorAdjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import inspect
import math
import os

import numpy as np
import pytest

filename = inspect.getframeinfo(inspect.currentframe()).filename
Expand All @@ -42,9 +42,9 @@
reasonErr = "python Pillow package not installed---can't test Cameras module"

# Import all of the modules that we are going to be called in this simulation
from Basilisk.utilities import SimulationBaseClass
from Basilisk.utilities import macros
from Basilisk.architecture import messaging
from Basilisk.utilities import macros
from Basilisk.utilities import SimulationBaseClass

try:
from Basilisk.simulation import camera
Expand All @@ -61,15 +61,15 @@
@pytest.mark.skipif(importErr, reason= reasonErr)
@pytest.mark.parametrize("HSV", [
[0, 0, 0]
, [1.0, +20.0, -30.0]
, [-1.0, +20.0, -30.0]
, [3.14159, +100, -100]
, [1.0, 20.0, -30.0]
, [-1.0, 20.0, -30.0]
, [3.14159, 100, -100]
])
@pytest.mark.parametrize("BGR", [
[0, 0, 0]
, [10, 20, 30]
, [-10, -30, +50]
, [-100, +200, +20]
, [-10, -30, 50]
, [-100, 200, 20]
])
# update "module" in this function name to reflect the module name
def test_module(show_plots, HSV, BGR):
Expand Down Expand Up @@ -155,9 +155,8 @@ def cameraColorTest(image, HSV, BGR):
module.sigma_CB = [0, 0, 1]

# Noise parameters
# BGR and HSV are python lists of the form [0, 0, 0]
module.bgrPercent = camera.IntVector(BGR)
module.hsv = camera.DoubleVector(HSV)
module.bgrPercent = np.array(BGR)
module.hsv = np.array(HSV)

# Setup logging on the test module output message so that we get all the writes to it
dataLog = module.cameraConfigOutMsg.recorder()
Expand All @@ -178,10 +177,6 @@ def cameraColorTest(image, HSV, BGR):
return [testFailCount, ''.join(testMessages)]


# these points correspond to the included 'tv_test.png'
testPoints = [(100, 300), (250, 300), (450, 300), (600, 300), (700, 300), (950, 300), (1100, 300), (300, 800),
(880, 780)]

def rgb_to_hsv(rgb):
hsv = colorsys.rgb_to_hsv(rgb[0], rgb[1], rgb[2])
return [hsv[0] * 180., hsv[1] * 255., hsv[2]]
Expand All @@ -196,6 +191,10 @@ def trueColorAdjust(image, corrupted, HSV, BGR):
input_rgb = Image.open(image).load()
output = Image.open(corrupted).load()

# these points correspond to the included 'tv_test.png'
testPoints = [(100, 300), (250, 300), (450, 300), (600, 300), (700, 300), (950, 300), (1100, 300), (300, 800),
(880, 780)]

for point in testPoints:
px = point[0]
py = point[1]
Expand Down
Loading
Loading