SelectImagePoints
When run, instantiates SelectImagePoints class and prompts user to select image and find key points.
‘escape’ key closes window. ‘s’ key saves data.
Notes
When the window launches, it first raises a dialog to select an image file. The dialog box only shows .RAW or .NEF files. Switch to “All files” to select images of other types (.jpg, .png, etc).
After selecting an image file, the program displays the image. But for some reason it shows up behind all other windows. If you minimize all other windows, then you can see the image. Note that the display does not include the window’s border, or minimize/maximize/close buttons, etc.
There are no prompts, but the program silently waits for you to click on the image somewhere. When you do, the image will be replaced by a small tile from the image in the vicinity of where you clicked, shown highly magnified. This enables you to select individual pixels while seeing surrounding context.
After you make the fine-grain selection on the enlarged window, the program redisplays the full image and waits.
You can then repeat the process to select additional points. The program is logging your selections in the background.
When you are done selecting points, press “s” to save and exit. There is no confirmation raised or written to the console.
The program writes the selected points in a file “points_<image_name>.txt”, which is written to the directory from which you launched the program. The file contains the path to the selected image.
Thus, to control the location where the list of points is written, cd to the directory you wish to save to, and then launch the program. You can use the file selection dialog to navigate to the image you want to select.
For example: (env_310_OpenCSP) PS C:> cd C:ctempselect_image_points_test (env_310_OpenCSP) PS C:ctempselect_image_points_test> python C:<path_to_code>CodeOpenCSPopencspppselect_image_pointsSelectImagePoints.py
The above will work if you have your default python run environment set to the virtual environment env_310_OpenCSP. If not, then you should explicitly specify this to ensure that all of the OpenCSP packages are available. You can do this by: PS C:ctempselect_image_points_test> C:<path_to_code>Codeenv_310_OpenCSPScriptspython.exe C:<path_to_code>CodeOpenCSPopencspppselect_image_pointsSelectImagePoints.py
If you are unsure whether the virtual environment will be run by default, you can use the get-command function: (env_310_OpenCSP) PS C:ctempselect_image_points_test> get-command python
This will show which python executable will be run. If the virtual environment is set as default, you should see something like this: CommandType Name Version Source ———– —- ——- —— Application python.exe 3.10.91… C:<path_to_code>Codeenv_310_OpenCSPScriptspython.exe
- class opencsp.app.select_image_points.SelectImagePoints.SelectImagePoints(root: Tk, file_name: str)
Bases:
objectClass to handle displaying images and recording user inputs
- click(event) None
Called when image is clicked
- click_fine(event)
Called when fine res image is clicked
- click_rough(event)
Called when full res image is clicked
- close() None
Closes window
- load_image_from_array(image: ndarray) None
Loads image into class from ndarray
- load_image_from_file(file: str) None
Loads image into class given filename
- revert_main_image()
Reverts the displayed image to the current main image
- run() None
Runs window
- save() None
Saves corner data then closes
- update_image() None
Updates the current displayed image to current loaded image