Disable cursor-pixel readout in CameraDisplay#1748
Open
abaeyens wants to merge 1 commit into
Open
Conversation
The pixel-value readout added in e6813d8 ("Show pixel co-ordinate with their pixel value in image", ros2#1716) lives in ImageDisplay and maps cursor position to image pixel coordinates assuming the image fills the panel with plain aspect-preserving letterboxing. CameraDisplay inherits this mapping but lays out its background image rectangle differently — via calculateScreenCorners(), which scales the rectangle by the user-controlled "Zoom Factor", applies a FOV-derived (not pixel-derived) aspect ratio, and honors CameraInfo.roi. None of that is taken into account by the inherited mapping, so the reported pixel value is wrong whenever the zoom factor is not 1 (and slightly off in some other cases too). Rather than duplicate or generalize the mapping for CameraDisplay, disable the readout there by no longer populating last_msg_ in CameraDisplay::processMessage(). With last_msg_ left unset, mapWidgetPosToImagePixel() short-circuits and the tooltip/status stay empty — silence is better than a plausible-looking but incorrect value. ImageDisplay itself is unaffected. Fixes ros2#1747 Signed-off-by: Arne Baeyens <mail@arnebaeyens.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The pixel-value readout added in e6813d8 ("Show pixel co-ordinate with their pixel value in image", #1716) lives in ImageDisplay and maps cursor position to image pixel coordinates assuming the image fills the panel with plain aspect-preserving letterboxing. CameraDisplay inherits this mapping but lays out its background image rectangle differently — via calculateScreenCorners(), which scales the rectangle by the user-controlled "Zoom Factor", applies a FOV-derived (not pixel-derived) aspect ratio, and honors CameraInfo.roi. None of that is taken into account by the inherited mapping, so the reported pixel value is wrong whenever the zoom factor is not 1 (and slightly off in some other cases too).
Rather than duplicate or generalize the mapping for CameraDisplay, disable the readout there by no longer populating last_msg_ in CameraDisplay::processMessage(). With last_msg_ left unset, mapWidgetPosToImagePixel() short-circuits and the tooltip/status stay empty — silence is better than a plausible-looking but incorrect value. ImageDisplay itself is unaffected.
Fixes #1747
Is this user-facing behavior change?
Yes, this fixes a user-facing bug.
Did you use Generative AI?
Claude Opus 4.7