diff --git a/.gitignore b/.gitignore index cd380b2..7b232e0 100644 --- a/.gitignore +++ b/.gitignore @@ -162,3 +162,8 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +# Vim stuff +*.swp +*.swn +*.swo diff --git a/send_d405_images.py b/send_d405_images.py index 9cbcdcd..65f13db 100644 --- a/send_d405_images.py +++ b/send_d405_images.py @@ -30,6 +30,17 @@ def autoAdjustments_with_convertScaleAbs(img): return new_img ########################### + +def adjust_gamma(image, gamma=1.0): + # build a lookup table mapping the pixel values [0, 255] to + # their adjusted gamma values + # NOTE: this code is from perplexity + invGamma = 1.0 / gamma + table = np.array([((i / 255.0) ** invGamma) * 255 for i in np.arange(0, 256)]).astype("uint8") + + # apply gamma correction using the lookup table + return cv2.LUT(image, table) + def main(use_remote_computer, exposure): try: @@ -95,6 +106,8 @@ def main(use_remote_computer, exposure): depth_image = np.asanyarray(depth_frame.get_data()) color_image = np.asanyarray(color_frame.get_data()) + color_image = adjust_gamma(color_image, 2) + brighten_image = False if brighten_image: color_image = autoAdjustments_with_convertScaleAbs(color_image) diff --git a/yolo_networking.py b/yolo_networking.py index afac438..1a161e7 100644 --- a/yolo_networking.py +++ b/yolo_networking.py @@ -1,7 +1,9 @@ # Set these values for your network -robot_ip = 'stretch-se3-####' -remote_computer_ip = 'MACHINE_NAME_HERE' +#robot_ip = 'stretch-se3-####' +#remote_computer_ip = 'MACHINE_NAME_HERE' +robot_ip = '192.168.1.15' +remote_computer_ip = '192.168.1.10' # Set these to your preferred port numbers # hello d405 => 4ello d405 => 4405